本文整理汇总了C++中output_warnings函数的典型用法代码示例。如果您正苦于以下问题:C++ output_warnings函数的具体用法?C++ output_warnings怎么用?C++ output_warnings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了output_warnings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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 ()
;
}
示例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 ()
;
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}
示例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 ();
}