Skip to content

Commit

Permalink
add kdbOpen() calls, so data from handle is already populated when ch…
Browse files Browse the repository at this point in the history
…ecking in tests
  • Loading branch information
lawli3t committed Mar 26, 2022
1 parent 5f0895b commit f77f178
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/plugins/resolver/testmod_resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ void test_resolve (void)

succeed_if (!strncmp (plugin->name, "resolver", strlen ("resolver")), "got wrong name");

// we need to invoke kdbGet at least once, otherwise the handle below will not yet be initialized
plugin->kdbGet(plugin, 0, parentKey);

resolverHandles * h = elektraPluginGetData (plugin);
exit_if_fail (h != 0, "no plugin handle");
succeed_if_same_string (h->system.path, "elektra.ecf");
Expand All @@ -72,6 +75,10 @@ void test_resolve (void)

// reinit with system path only
plugin->kdbOpen (plugin, parentKey);

// we need to invoke kdbGet at least once, otherwise the handle below will not yet be initialized
plugin->kdbGet(plugin, 0, parentKey);

h = elektraPluginGetData (plugin);
exit_if_fail (h != 0, "no plugin handle");
succeed_if_same_string (h->system.path, "elektra.ecf");
Expand Down Expand Up @@ -121,10 +128,14 @@ void test_name (void)

succeed_if (!strncmp (plugin->name, "resolver", strlen ("resolver")), "got wrong name");

Key * parentKey = keyNew ("system:/", KEY_END);

// we need to invoke kdbGet at least once, otherwise the handle below will not yet be initialized
plugin->kdbGet(plugin, 0, parentKey);

resolverHandles * h = elektraPluginGetData (plugin);
succeed_if (h != 0, "no plugin handle");

Key * parentKey = keyNew ("system:/", KEY_END);
plugin->kdbGet (plugin, 0, parentKey);
if (KDB_DB_SYSTEM[0] == '~')
{
Expand Down Expand Up @@ -169,10 +180,13 @@ void test_lockname (void)

succeed_if (!strncmp (plugin->name, "resolver", strlen ("resolver")), "got wrong name");

Key * parentKey = keyNew ("system:/", KEY_END);
// we need to invoke kdbGet at least once, otherwise the handle below will not yet be initialized
plugin->kdbGet(plugin, 0, parentKey);

resolverHandles * h = elektraPluginGetData (plugin);
succeed_if (h != 0, "no plugin handle");

Key * parentKey = keyNew ("system:/", KEY_END);
plugin->kdbGet (plugin, 0, parentKey);
if (h && KDB_DB_SYSTEM[0] == '~')
{
Expand Down Expand Up @@ -219,11 +233,13 @@ void test_tempname (void)

succeed_if (!strncmp (plugin->name, "resolver", strlen ("resolver")), "got wrong name");

Key * parentKey = keyNew ("system:/", KEY_END);
// we need to invoke kdbGet at least once, otherwise the handle below will not yet be initialized
plugin->kdbGet(plugin, 0, parentKey);

resolverHandles * h = elektraPluginGetData (plugin);
succeed_if (h != 0, "no plugin handle");

Key * parentKey = keyNew ("system:/", KEY_END);
plugin->kdbGet (plugin, 0, parentKey);
if (h && KDB_DB_SYSTEM[0] == '~')
{
// only check filename and issue warning
Expand Down

0 comments on commit f77f178

Please sign in to comment.