本文整理汇总了C++中output_warnings函数的典型用法代码示例。如果您正苦于以下问题:C++ output_warnings函数的具体用法?C++ output_warnings怎么用?C++ output_warnings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了output_warnings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_readWrite
void test_readWrite (const char * fileName, KeySet * conf)
{
printf ("Test read write with %s\n", srcdir_file (fileName));
Plugin * plugin = elektraPluginOpen ("yajl", modules, conf, 0);
exit_if_fail (plugin != 0, "could not open plugin");
// printf ("Test with %s\n", srcdir_file(fileName));
Key * parentKey = keyNew ("user/tests/yajl", KEY_VALUE, srcdir_file (fileName), KEY_END);
KeySet * keys = ksNew (0, KS_END);
succeed_if (plugin->kdbGet (plugin, keys, parentKey) == 1, "kdbGet was not successful");
succeed_if (output_error (parentKey), "error in kdbGet");
succeed_if (output_warnings (parentKey), "warnings in kdbGet");
// output_keyset(keys);
keySetString (parentKey, elektraFilename ());
// keySetString(parentKey, "/proc/self/fd/1");
// printf("File name is: %s\n", keyString(parentKey));
succeed_if (plugin->kdbSet (plugin, keys, parentKey) == 1, "kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
succeed_if (compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected");
elektraUnlink (keyString (parentKey));
keyDel (parentKey);
ksDel (keys);
elektraPluginClose (plugin, 0);
}
开发者ID:reox,项目名称:libelektra,代码行数:32,代码来源:testmod_yajl.c
示例2: test_two_scripts
// test loading lua twice
static void test_two_scripts (void)
{
printf ("Testing loading of two active lua plugins...\n");
KeySet * modules = ksNew (0, KS_END);
elektraModulesInit (modules, 0);
KeySet * conf = ksNew (2, keyNew ("user/script", KEY_VALUE, srcdir_file ("lua/lua_plugin.lua"), KEY_END),
keyNew ("user/print", KEY_END), KS_END);
KeySet * conf2 = ksNew (2, keyNew ("user/script", KEY_VALUE, srcdir_file ("lua/lua_plugin2.lua"), KEY_END),
keyNew ("user/print", KEY_END), KS_END);
Key * errorKey = keyNew ("", KEY_END);
Plugin * plugin = elektraPluginOpen ("lua", modules, conf, errorKey);
succeed_if (output_warnings (errorKey), "warnings in kdbOpen");
succeed_if (output_error (errorKey), "errors in kdbOpen");
exit_if_fail (plugin != NULL, "unable to load lua plugin");
keyDel (errorKey);
Key * errorKey2 = keyNew ("", KEY_END);
Plugin * plugin2 = elektraPluginOpen ("lua", modules, conf2, errorKey2);
succeed_if (output_warnings (errorKey2), "warnings in kdbOpen");
succeed_if (output_error (errorKey2), "errors in kdbOpen");
exit_if_fail (plugin2 != NULL, "unable to load lua plugin again");
keyDel (errorKey2);
elektraPluginClose (plugin2, 0);
elektraPluginClose (plugin, 0);
elektraModulesClose (modules, 0);
ksDel (modules);
}
开发者ID:reox,项目名称:libelektra,代码行数:33,代码来源:testmod_lua.c
示例3: test_hostLensFormatting
void test_hostLensFormatting(char *fileName)
{
Key *parentKey = keyNew ("user/tests/augeas-hosts", KEY_VALUE,
srcdir_file (fileName), KEY_END);
KeySet *conf = ksNew (20,
keyNew ("system/lens", KEY_VALUE, "Hosts.lns", KEY_END), KS_END);
PLUGIN_OPEN("augeas");
KeySet *ks = ksNew(0, KS_END);
succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1,
"call to kdbGet was not successful");
succeed_if(output_error (parentKey), "error in kdbGet");
succeed_if(output_warnings (parentKey), "warnings in kdbGet");
keySetString (parentKey, elektraFilename());
succeed_if(plugin->kdbSet (plugin, ks, parentKey) == 1,
"kdbSet was not successful");
succeed_if(output_error (parentKey), "error in kdbSet");
succeed_if(output_warnings (parentKey), "warnings in kdbSet");
succeed_if(
compare_line_files (srcdir_file (fileName), keyString (parentKey)),
"files do not match as expected");
elektraUnlink(keyString (parentKey));
keyDel (parentKey);
ksDel (ks);
PLUGIN_CLOSE ()
;
}
开发者ID:beku,项目名称:libelektra,代码行数:35,代码来源:testmod_augeas.c
示例4: test_hostLensDelete
void test_hostLensDelete(char *sourceFile, char *compFile)
{
Key *parentKey = keyNew ("user/tests/augeas-hosts", KEY_VALUE,
srcdir_file (sourceFile), KEY_END);
KeySet *conf = ksNew (20,
keyNew ("system/lens", KEY_VALUE, "Hosts.lns", KEY_END), KS_END);
PLUGIN_OPEN("augeas");
KeySet *ks = ksNew(0, KS_END);
succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1,
"call to kdbGet was not successful");
succeed_if(output_error (parentKey), "error in kdbGet");
succeed_if(output_warnings (parentKey), "warnings in kdbGet");
Key *key = ksLookupByName (ks, "user/tests/augeas-hosts/1", 0);
exit_if_fail(key, "localhost not found");
ksPopAtCursor(ks, ksGetCursor(ks));
keyDel (key);
key = ksLookupByName (ks, "user/tests/augeas-hosts/1/ipaddr", 0);
exit_if_fail(key, "ip address of localhost not found");
ksPopAtCursor(ks, ksGetCursor(ks));
keyDel (key);
key = ksLookupByName (ks, "user/tests/augeas-hosts/1/canonical", 0);
exit_if_fail(key, "canonical of localhost not found");
ksPopAtCursor(ks, ksGetCursor(ks));
keyDel (key);
key = ksLookupByName (ks, "user/tests/augeas-hosts/1/#comment", 0);
exit_if_fail(key, "comment of localhost not found");
ksPopAtCursor(ks, ksGetCursor(ks));
keyDel (key);
keySetString (parentKey, elektraFilename());
succeed_if(plugin->kdbSet (plugin, ks, parentKey) == 1,
"kdbSet was not successful");
succeed_if(output_error (parentKey), "error in kdbSet");
succeed_if(output_warnings (parentKey), "warnings in kdbSet");
succeed_if(
compare_line_files (srcdir_file (compFile), keyString (parentKey)),
"files do not match as expected");
ksDel (ks);
elektraUnlink(keyString (parentKey));
keyDel (parentKey);
PLUGIN_CLOSE ()
;
}
开发者ID:beku,项目名称:libelektra,代码行数:55,代码来源:testmod_augeas.c
示例5: test_metaMerging
void test_metaMerging ()
{
Key *parentKey = keyNew ("user/tests/keytometa", KEY_END);
KeySet *conf = ksNew(0, KS_END);
PLUGIN_OPEN("keytometa");
KeySet* ks = createMergeTestkeys ();
succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1,
"call to kdbGet was not successful");
succeed_if(output_error (parentKey), "error in kdbGet");
succeed_if(output_warnings (parentKey), "warnings in kdbGet");
Key *key = ksLookupByName(ks, "user/normalkey1", 0);
succeed_if (key, "normalkey1 was removed");
const Key *metaKey1 = keyGetMeta(key, "testmeta");
succeed_if (metaKey1, "normalkey1 contained no metakey");
const char *expected1 = "meta line 1\nmeta line 2\nmeta line 3";
succeed_if (!strcmp (keyString(metaKey1), expected1), "metakey of normalkey1 contained incorrect data");
key = ksLookupByName(ks, "user/normalkey2", 0);
succeed_if (key, "normalkey2 was removed");
const Key *metaKey2 = keyGetMeta(key, "testmeta");
succeed_if (metaKey2, "normalkey2 contained no metakey");
const char *expected2 = "meta line 30\nmeta line 31\nmeta line 32";
succeed_if (!strcmp (keyString(metaKey2), expected2), "metakey of normalkey2 contained incorrect data");
/* change the value of the middle key */
keySetMeta(key, "testmeta", "meta line 30\nchanged meta line\nmeta line 32");
succeed_if(plugin->kdbSet (plugin, ks, parentKey) >= 1,
"call to kdbSet was not successful");
succeed_if(output_error (parentKey), "error in kdbSet");
succeed_if(output_warnings (parentKey), "warnings in kdbSet");
key = ksLookupByName(ks, "user/convertkey30", 0);
succeed_if (key, "convertkey30 was not restored");
succeed_if (!strcmp (keyString(key), "meta line 30"), "value of convertkey30 was modified");
key = ksLookupByName (ks, "user/convertkey31", 0);
succeed_if (key, "convertkey31 was not restored");
succeed_if (!strcmp (keyString(key), "changed meta line"), "meta information was not written back to convertkey31");
key = ksLookupByName (ks, "user/convertkey32", 0);
succeed_if (key, "convertkey32 was not restored");
succeed_if (!strcmp (keyString(key), "meta line 32"), "value of convertkey32 was modified");
keyDel (parentKey);
ksDel(ks);
PLUGIN_CLOSE ();
}
开发者ID:tryge,项目名称:libelektra,代码行数:52,代码来源:testmod_keytometa.c
示例6: test_setGlobalMatch
void test_setGlobalMatch (void)
{
Key * parentKey = keyNew ("user/tests/glob", KEY_END);
// clang-format off
KeySet *conf = ksNew (20,
keyNew ("user/glob/#1", KEY_VALUE, "/*",
KEY_META, "testmetakey1", "testvalue1",
KEY_META, "testmetakey2", "testvalue2",
KEY_END),
KS_END);
// clang-format on
PLUGIN_OPEN ("glob");
KeySet * ks = createKeys ();
succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
testKeys (ks);
ksDel (ks);
keyDel (parentKey);
PLUGIN_CLOSE ();
}
开发者ID:reox,项目名称:libelektra,代码行数:25,代码来源:testmod_glob.c
示例7: test_simpleCutOnGet
static void test_simpleCutOnGet ()
{
Key *parentKey = keyNew ("user/tests/rename", KEY_END);
KeySet *conf = ksNew (20,
keyNew ("system/cut", KEY_VALUE, "will/be/stripped", KEY_END), KS_END);
PLUGIN_OPEN("rename");
KeySet *ks = createSimpleTestKeys();
ksAppendKey(ks, parentKey);
succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1,
"call to kdbGet was not successful");
succeed_if(output_error (parentKey), "error in kdbGet");
succeed_if(output_warnings (parentKey), "warnings in kdbGet");
checkSimpleTestKeys (ks);
ksDel(ks);
/*
* this has to be done because the parentKey is not
* part of ks anymore due to renaming
*/
keyDel(parentKey);
PLUGIN_CLOSE ();
}
开发者ID:tryge,项目名称:libelektra,代码行数:26,代码来源:testmod_rename.c
示例8: test_addNewBaseToParentKey
static void test_addNewBaseToParentKey()
{
Key *parentKey = keyNew ("user/tests/rename", KEY_END);
KeySet *conf = ksNew (20,
keyNew ("system/cut", KEY_VALUE, "new/base", KEY_END), KS_END);
PLUGIN_OPEN("rename");
KeySet *ks = ksNew(0, KS_END);
keyIncRef(parentKey);
ksAppendKey (ks, parentKey);
succeed_if(plugin->kdbSet (plugin, ks, parentKey) >= 1,
"call to kdbSet was not successful");
succeed_if(output_error (parentKey), "error in kdbSet");
succeed_if(output_warnings (parentKey), "warnings in kdbSet");
Key *key = ksLookupByName (ks, "user/tests/rename/new/base", 0);
succeed_if (key, "new base was not correctly appended to parent key");
ksDel(ks);
keyDecRef(parentKey);
keyDel(parentKey);
PLUGIN_CLOSE ();
}
开发者ID:tryge,项目名称:libelektra,代码行数:26,代码来源:testmod_rename.c
示例9: test_rebaseOfNewKeys
static void test_rebaseOfNewKeys()
{
Key *parentKey = keyNew ("user/tests/rename", KEY_END);
KeySet *conf = ksNew (20,
keyNew ("system/cut", KEY_VALUE, "new/base", KEY_END), KS_END);
PLUGIN_OPEN("rename");
KeySet *ks = ksNew(20,
/* this key was seen by rename before and wont be changed */
keyNew("user/tests/rename/key1",
KEY_VALUE, "value1",
KEY_META, ELEKTRA_ORIGINAL_NAME_META, "user/tests/rename/key1",
KEY_END),
/* this key was not seen by rename before and will be renamed */
keyNew("user/tests/rename/key2",
KEY_VALUE, "value2",
KEY_END),
KS_END);
succeed_if(plugin->kdbSet (plugin, ks, parentKey) >= 1,
"call to kdbSet was not successful");
succeed_if(output_error (parentKey), "error in kdbSet");
succeed_if(output_warnings (parentKey), "warnings in kdbSet");
Key* key = ksLookupByName (ks, "user/tests/rename/key1", KDB_O_NONE);
succeed_if(key, "key1 was not found anymore, but it should not have been renamed");
key = ksLookupByName (ks, "user/tests/rename/new/base/key2", KDB_O_NONE);
succeed_if(key, "key2 was not correctly renamed");
keyDel (parentKey);
ksDel(ks);
PLUGIN_CLOSE ();
}
开发者ID:tryge,项目名称:libelektra,代码行数:34,代码来源:testmod_rename.c
示例10: test_metaConfigTakesPrecedence
static void test_metaConfigTakesPrecedence()
{
Key *parentKey = keyNew ("user/tests/rename", KEY_END);
KeySet *conf = ksNew (20,
keyNew ("system/cut", KEY_VALUE, "will/be", KEY_END), KS_END);
PLUGIN_OPEN("rename");
KeySet *ks = createSimpleMetaTestKeys();
ksAppendKey(ks, parentKey);
succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1,
"call to kdbGet was not successful");
succeed_if(output_error (parentKey), "error in kdbGet");
succeed_if(output_warnings (parentKey), "warnings in kdbGet");
/* the first two keys should have been renamed by their metadata */
Key* key = ksLookupByName (ks, "user/tests/rename/key1", KDB_O_NONE);
succeed_if(key, "key1 was not correctly renamed");
key = ksLookupByName (ks, "user/tests/rename/key2", KDB_O_NONE);
succeed_if(key, "key2 was not correctly renamed");
/* the third key should have been renamed by the global config */
key = ksLookupByName (ks, "user/tests/rename/stripped", KDB_O_NONE);
succeed_if(key, "key3 was renamed but would replace the parent key");
/* the fourth key was not renamed because the prefix did not match */
key = ksLookupByName (ks, "user/tests/rename/will/not/be/stripped/key4", KDB_O_NONE);
succeed_if(key, "key4 was renamed although its prefix did not match");
keyDel (parentKey);
ksDel(ks);
PLUGIN_CLOSE ();
}
开发者ID:tryge,项目名称:libelektra,代码行数:33,代码来源:testmod_rename.c
示例11: test_zeroMatchFlags
void test_zeroMatchFlags (void)
{
Key * parentKey = keyNew ("user/tests/glob", KEY_END);
KeySet * conf = ksNew (20, keyNew ("user/glob/#1", KEY_VALUE, "*test1", KEY_META, "testmetakey1", "testvalue1", KEY_END),
/* disable default pathname globbing behaviour */
keyNew ("user/glob/#1/flags", KEY_VALUE, "", KEY_END), KS_END);
PLUGIN_OPEN ("glob");
KeySet * ks = createKeys ();
succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
Key * key = ksLookupByName (ks, "user/tests/glob/test1", 0);
exit_if_fail (key, "key user/tests/glob/test1 not found");
const Key * metaKey1 = keyGetMeta (key, "testmetakey1");
exit_if_fail (metaKey1, "testmetakey1 not found");
succeed_if (strcmp ("testvalue1", keyValue (metaKey1)) == 0, "value of metakey testmetakey1 not correct");
key = ksLookupByName (ks, "user/tests/glob/test3", 0);
exit_if_fail (key, "user/tests/glob/test3 not found");
succeed_if (!keyGetMeta (key, "testmetakey1"), "testmetakey1 copied to wrong key");
key = ksLookupByName (ks, "user/tests/glob/test2/subtest1", 0);
exit_if_fail (key, "user/tests/glob/test2/subtest1 not found");
const Key * metaKey2 = keyGetMeta (key, "testmetakey1");
exit_if_fail (metaKey2, "testmetakey1 not found");
succeed_if (strcmp ("testvalue1", keyValue (metaKey2)) == 0, "value of metakey testmetakey1 not correct");
ksDel (ks);
keyDel (parentKey);
PLUGIN_CLOSE ();
}
开发者ID:reox,项目名称:libelektra,代码行数:35,代码来源:testmod_glob.c
示例12: test_differentMetaNames
void test_differentMetaNames (void)
{
Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
KeySet * conf = ksNew (0, KS_END);
PLUGIN_OPEN ("keytometa");
KeySet * ks = createDifferentMetaNameTestKeys ();
succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
succeed_if (output_error (parentKey), "error in kdbGet");
succeed_if (output_warnings (parentKey), "warnings in kdbGet");
Key * key = ksLookupByName (ks, "user/normalkey1", 0);
succeed_if (key, "normalkey1 was removed");
const Key * metaKey1 = keyGetMeta (key, "testmeta1");
succeed_if (metaKey1, "normalkey1 contained no meta testmeta1");
const char * expected1 = "meta line1";
succeed_if (!strcmp (keyString (metaKey1), expected1), "metakey testmeta1 of normalkey1 contained incorrect data");
const Key * metaKey2 = keyGetMeta (key, "testmeta2");
succeed_if (metaKey2, "normalkey1 contained no meta testmeta1");
const char * expected2 = "meta line2";
succeed_if (!strcmp (keyString (metaKey2), expected2), "metakey testmeta1 of normalkey1 contained incorrect data");
keyDel (parentKey);
ksDel (ks);
PLUGIN_CLOSE ();
}
开发者ID:0003088,项目名称:libelektra,代码行数:28,代码来源:testmod_keytometa.c
示例13: test_plainIniWrite
static void test_plainIniWrite (char * fileName)
{
Key * parentKey = keyNew ("user/tests/ini-write", KEY_VALUE, elektraFilename (), KEY_END);
KeySet * conf = ksNew (0, KS_END);
PLUGIN_OPEN ("ini");
KeySet * ks = ksNew (30, keyNew ("user/tests/ini-write/nosectionkey", KEY_VALUE, "nosectionvalue", KEY_END),
keyNew ("user/tests/ini-write/section1", KEY_BINARY, KEY_END),
keyNew ("user/tests/ini-write/section1/key1", KEY_VALUE, "value1", KEY_END),
keyNew ("user/tests/ini-write/section1/key2", KEY_VALUE, "value2", KEY_END),
keyNew ("user/tests/ini-write/section2", KEY_BINARY, KEY_END),
keyNew ("user/tests/ini-write/section2/key3", KEY_VALUE, "value3", KEY_END),
keyNew ("user/tests/ini-write/section2/emptykey", KEY_END), KS_END);
succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
succeed_if (compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected");
keyDel (parentKey);
ksDel (ks);
PLUGIN_CLOSE ();
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:25,代码来源:testmod_ini.c
示例14: test_appendSameLevel
void test_appendSameLevel (void)
{
Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
KeySet * conf = ksNew (0, KS_END);
PLUGIN_OPEN ("keytometa");
KeySet * ks = createSameLevelTestKeys ();
succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
succeed_if (output_error (parentKey), "error in kdbGet");
succeed_if (output_warnings (parentKey), "warnings in kdbGet");
/* convertkey1 should be converted to childkey1 as childkey1 is on the same level as requested */
Key * childKey = ksLookupByName (ks, "user/levelkey1/childkey1", 0);
succeed_if (childKey, "childkey1 was removed");
const Key * metaKey1 = keyGetMeta (childKey, "testmeta");
succeed_if (metaKey1, "childkey1 contained no meta testmeta");
const char * expected1 = "convertkey1value";
succeed_if (!strcmp (keyString (metaKey1), expected1), "metakey testmeta of childkey1 contained incorrect data");
/* convertkey2 should be converted to levelkey as the next key in order is not on the same level */
Key * levelkey1 = ksLookupByName (ks, "user/levelkey1", 0);
succeed_if (levelkey1, "levelkey1 was removed");
const Key * metaKey2 = keyGetMeta (levelkey1, "testmeta");
succeed_if (metaKey2, "levelkey1 contained no meta testmeta");
const char * expected2 = "convertkey2value";
succeed_if (!strcmp (keyString (metaKey2), expected2), "metakey testmeta of levelkey1 contained incorrect data");
keyDel (parentKey);
ksDel (ks);
PLUGIN_CLOSE ();
}
开发者ID:0003088,项目名称:libelektra,代码行数:33,代码来源:testmod_keytometa.c
示例15: test_multilineIniWrite
static void test_multilineIniWrite (char * fileName)
{
Key * parentKey = keyNew ("user/tests/ini-multiline-write", KEY_VALUE, elektraFilename (), KEY_END);
KeySet * conf = ksNew (30, keyNew ("system/multiline", KEY_VALUE, "1", KEY_END),
keyNew ("system/linecont", KEY_VALUE, "\t", KEY_END), KS_END);
PLUGIN_OPEN ("ini");
KeySet * ks = ksNew (
30, keyNew ("user/tests/ini-multiline-write/multilinesection", KEY_BINARY, KEY_END),
keyNew ("user/tests/ini-multiline-write/multilinesection/key1", KEY_VALUE, "value1\nwith continuation\nlines", KEY_END),
keyNew ("user/tests/ini-multiline-write/singlelinesection", KEY_BINARY, KEY_END),
keyNew ("user/tests/ini-multiline-write/singlelinesection/key2", KEY_VALUE, "", KEY_END),
keyNew ("user/tests/ini-multiline-write/singlelinesection/key3", KEY_VALUE, "value3", KEY_END), KS_END);
succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
succeed_if (compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected");
ksDel (ks);
keyDel (parentKey);
PLUGIN_CLOSE ();
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:25,代码来源:testmod_ini.c
示例16: test_plainIniRead
static void test_plainIniRead (char * fileName)
{
Key * parentKey = keyNew ("user/tests/ini-read", KEY_VALUE, srcdir_file (fileName), KEY_END);
KeySet * conf = ksNew (0, KS_END);
PLUGIN_OPEN ("ini");
KeySet * ks = ksNew (0, KS_END);
succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
succeed_if (output_error (parentKey), "error in kdbGet");
succeed_if (output_warnings (parentKey), "warnings in kdbGet");
Key * key = ksLookupByName (ks, "user/tests/ini-read/nosectionkey", KDB_O_NONE);
exit_if_fail (key, "nosectionkey not found");
succeed_if (!strcmp ("nosectionvalue", keyString (key)), "nosectionkey contained invalid data");
key = ksLookupByName (ks, "user/tests/ini-read/section1", KDB_O_NONE);
exit_if_fail (key, "section1 not found");
succeed_if (!keyValue (key), "section value was not empty");
key = ksLookupByName (ks, "user/tests/ini-read/section1/key1", KDB_O_NONE);
exit_if_fail (key, "key1 not found");
succeed_if (!strcmp ("value1", keyString (key)), "key1 contained invalid data");
key = ksLookupByName (ks, "user/tests/ini-read/section2/emptykey", KDB_O_NONE);
exit_if_fail (key, "emptykey not found");
succeed_if (!strcmp ("", keyString (key)), "emptykey contained invalid data");
ksDel (ks);
keyDel (parentKey);
PLUGIN_CLOSE ();
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:34,代码来源:testmod_ini.c
示例17: test_withoutConfig
static void test_withoutConfig()
{
Key *parentKey = keyNew ("user/tests/rename", KEY_END);
Key *parentKeyCopy = keyDup(parentKey);
KeySet *conf = ksNew (0, KS_END);
PLUGIN_OPEN("rename");
KeySet *ks = createSimpleTestKeys();
ksAppendKey(ks, parentKey);
succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1,
"call to kdbGet was not successful");
succeed_if(output_error (parentKey), "error in kdbGet");
succeed_if(output_warnings (parentKey), "warnings in kdbGet");
KeySet *expected = createSimpleTestKeys();
ksAppendKey(expected, parentKeyCopy);
compareKeySets(ks, expected);
keyDel (parentKey);
keyDel (parentKeyCopy);
ksDel(expected);
ksDel(ks);
PLUGIN_CLOSE ();
}
开发者ID:tryge,项目名称:libelektra,代码行数:25,代码来源:testmod_rename.c
示例18: test_multilineIniRead
static void test_multilineIniRead (char * fileName)
{
Key * parentKey = keyNew ("user/tests/ini-multiline-read", KEY_VALUE, srcdir_file (fileName), KEY_END);
KeySet * conf = ksNew (30, keyNew ("system/multiline", KEY_VALUE, "1", KEY_END),
keyNew ("system/linecont", KEY_VALUE, "\t", KEY_END), KS_END);
PLUGIN_OPEN ("ini");
KeySet * ks = ksNew (0, KS_END);
succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
succeed_if (output_error (parentKey), "error in kdbGet");
succeed_if (output_warnings (parentKey), "warnings in kdbGet");
Key * key = ksLookupByName (ks, "user/tests/ini-multiline-read/multilinesection/key1", KDB_O_NONE);
exit_if_fail (key, "key1 not found");
succeed_if (!strcmp ("value1\nwith continuation\nlines", keyString (key)), "key1 contained invalid data");
key = ksLookupByName (ks, "user/tests/ini-multiline-read/singlelinesection/key2", KDB_O_NONE);
exit_if_fail (key, "key2 not found");
succeed_if (!strcmp ("", keyString (key)), "key2 contained invalid data");
key = ksLookupByName (ks, "user/tests/ini-multiline-read/singlelinesection/key3", KDB_O_NONE);
exit_if_fail (key, "key3 not found");
succeed_if (!strcmp ("value3", keyString (key)), "key3 contained invalid data");
ksDel (ks);
keyDel (parentKey);
PLUGIN_CLOSE ();
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:31,代码来源:testmod_ini.c
示例19: test_plainIniEmptyWrite
static void test_plainIniEmptyWrite (char * fileName)
{
Key * parentKey = keyNew ("user/tests/ini-write", KEY_VALUE, elektraFilename (), KEY_END);
KeySet * conf = ksNew (0, KS_END);
PLUGIN_OPEN ("ini");
KeySet * ks = ksNew (30, keyNew ("user/tests/ini-write/nosectionkey", KEY_VALUE, "nosectionvalue", KEY_END),
keyNew ("user/tests/ini-write/section1", KEY_BINARY,
KEY_END),
keyNew ("user/tests/ini-write/section1/key1", KEY_VALUE, "value1", KEY_END),
keyNew ("user/tests/ini-write/section1/key2", KEY_VALUE, "value2", KEY_END),
keyNew ("user/tests/ini-write/section2", KEY_BINARY, KEY_END),
keyNew ("user/tests/ini-write/section2/key3", KEY_VALUE, "value3", KEY_END),
keyNew ("user/tests/ini-write/section2/emptykey", KEY_META, "ini/empty", "", KEY_END), KS_END);
succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
succeed_if (compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected");
KeySet * readKS = ksNew (0, KS_END);
succeed_if (plugin->kdbGet (plugin, readKS, parentKey) >= 0, "kdbGet failed");
const Key * meta;
Key * searchKey = keyNew ("user/tests/ini-write/section2/emptykey", KEY_META, "ini/empty", "", KEY_END);
Key * key = ksLookup (readKS, searchKey, KDB_O_NONE);
meta = keyGetMeta (key, "ini/empty");
succeed_if (meta != NULL, "reading empty key again failed");
ksDel (readKS);
keyDel (parentKey);
keyDel (searchKey);
ksDel (ks);
PLUGIN_CLOSE ();
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:35,代码来源:testmod_ini.c
示例20: test_namedMatchFlags
void test_namedMatchFlags (void)
{
Key * parentKey = keyNew ("user/tests/glob", KEY_END);
KeySet * conf = ksNew (20, keyNew ("user/glob/#1", KEY_VALUE, "user/tests/glob/*", KEY_META, "testmetakey1", "testvalue1", KEY_END),
/* explicitly request pathname matching */
keyNew ("user/glob/#1/flags", KEY_VALUE, "pathname", KEY_END), KS_END);
PLUGIN_OPEN ("glob");
KeySet * ks = createKeys ();
succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
succeed_if (output_error (parentKey), "error in kdbSet");
succeed_if (output_warnings (parentKey), "warnings in kdbSet");
Key * key = ksLookupByName (ks, "user/tests/glob/test1", 0);
exit_if_fail (key, "key user/tests/glob/test1 not found");
const Key * metaKey1 = keyGetMeta (key, "testmetakey1");
exit_if_fail (metaKey1, "testmetakey1 not found");
key = ksLookupByName (ks, "user/tests/glob/test3", 0);
exit_if_fail (key, "user/tests/glob/test3 not found");
const Key * metaKey2 = keyGetMeta (key, "testmetakey1");
exit_if_fail (metaKey2, "testmetakey1 not found");
key = ksLookupByName (ks, "user/tests/glob/test2/subtest1", 0);
exit_if_fail (key, "user/tests/glob/test2/subtest1 not found");
const Key * metaKey3 = keyGetMeta (key, "testmetakey1");
exit_if_fail (!metaKey3, "testmetakey1 was copied to subtest1, but subtest1 should not be matched with pathname flag");
ksDel (ks);
keyDel (parentKey);
PLUGIN_CLOSE ();
}
开发者ID:reox,项目名称:libelektra,代码行数:33,代码来源:testmod_glob.c
注:本文中的output_warnings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论