• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PLUGIN_OPEN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PLUGIN_OPEN函数的典型用法代码示例。如果您正苦于以下问题:C++ PLUGIN_OPEN函数的具体用法?C++ PLUGIN_OPEN怎么用?C++ PLUGIN_OPEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PLUGIN_OPEN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_setDirectionMatch

void test_setDirectionMatch()
{
	Key *parentKey = keyNew ("user/tests/glob", KEY_END);
	KeySet *conf = ksNew (20,
			keyNew ("user/glob/set/#1", KEY_VALUE, "/*",
					KEY_META, "testmetakey1", "testvalue1",
					KEY_META, "testmetakey2", "testvalue2",
					KEY_END),
			keyNew ("user/glob/get/#1", KEY_VALUE, "/*/*",
					KEY_META, "testmetakey1", "testvalue1",
					KEY_META, "testmetakey2", "testvalue2",
					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");

	testKeys (ks);
	ksDel(ks);
	keyDel(parentKey);

	PLUGIN_CLOSE();
}
开发者ID:tryge,项目名称:libelektra,代码行数:28,代码来源:testmod_glob.c


示例2: test_intNoUpdateWithValueExceedingIntMin

static void test_intNoUpdateWithValueExceedingIntMin (void)
{
	printf ("test no update with value that exceeds INT_MIN\n");

	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("internalnotification");

	Key * valueKey = keyNew ("user/test/internalnotification/value", KEY_END);
	KeySet * ks = ksNew (1, valueKey, KS_END);

	int value = 123;
	succeed_if (internalnotificationRegisterInt (plugin, valueKey, &value) == 1,
		    "call to elektraInternalnotificationRegisterInt was not successful");

	long long exceedsInt = (long long) INT_MIN - 1;
	char * stringValue = convertLongLongToString (exceedsInt);
	keySetString (valueKey, stringValue);

	elektraInternalnotificationUpdateRegisteredKeys (plugin, ks);

	succeed_if (value == 123, "registered value was updated");

	elektraFree (stringValue);
	ksDel (ks);
	PLUGIN_CLOSE ();
}
开发者ID:waht,项目名称:libelektra,代码行数:26,代码来源:testmod_internalnotification.c


示例3: test_mmap_ksCopy

static void test_mmap_ksCopy (const char * tmpFile)
{
	Key * parentKey = keyNew (TEST_ROOT_KEY, KEY_VALUE, tmpFile, KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("mmapstorage");

	KeySet * ks = simpleTestKeySet ();
	succeed_if (plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful");
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) == 1, "kdbGet was not successful");
	succeed_if ((ks->flags & KS_FLAG_MMAP_ARRAY) == KS_FLAG_MMAP_ARRAY, "KeySet array not in mmap");

	KeySet * copyKs = ksNew (0, KS_END);
	if (ksCopy (copyKs, ks) == 1)
	{
		compare_keyset (copyKs, ks);
		compare_keyset (ks, copyKs);
	}
	else
	{
		yield_error ("ksCopy failed");
	}

	ksDel (copyKs);
	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}
开发者ID:sanssecours,项目名称:libelektra,代码行数:27,代码来源:testmod_mmapstorage.c


示例4: test_mmap_opmphm

static void test_mmap_opmphm (const char * tmpFile)
{
	Key * parentKey = keyNew (TEST_ROOT_KEY, KEY_VALUE, tmpFile, KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("mmapstorage");
	KeySet * ks = largeTestKeySet ();

	succeed_if (plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful");
	ksDel (ks);

	ks = ksNew (0, KS_END);
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) == 1, "kdbGet was not successful");

	const char * name = "user/tests/mmapstorage/dir7/key3";
	Key * found = ksLookupByName (ks, name, KDB_O_OPMPHM);

	if (!found)
	{
		yield_error ("Key not found.")
	}

	// write keyset with OPMPHM structures
	succeed_if (plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful");

	ksDel (ks);
	keyDel (parentKey);
	PLUGIN_CLOSE ();
}
开发者ID:sanssecours,项目名称:libelektra,代码行数:28,代码来源:testmod_mmapstorage.c


示例5: test_readfstab

void test_readfstab (const char * file)
{
	Key * parentKey = keyNew ("user/tests/fstab", KEY_VALUE, srcdir_file (file), KEY_END);
	KeySet * conf = 0;
	PLUGIN_OPEN ("fstab");

	KeySet * ks = ksNew (0, KS_END);

	printf ("Reading fstab using file: %s\n", file);

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");

	// output_keyset(ks);

	Key * key = ksLookupByName (ks, "user/tests/fstab/\\//device", 0);
	exit_if_fail (key, "rootfs device not found");
	succeed_if (strcmp ("/dev/sda1", keyValue (key)) == 0, "device not correct");

	key = ksLookupByName (ks, "user/tests/fstab/\\/media\\/ext4/device", 0);
	exit_if_fail (key, "media device not found");
	succeed_if (strcmp ("/dev/sdg1", keyValue (key)) == 0, "device not correct");

	exit_if_fail (key = ksLookupByName (ks, "user/tests/fstab/\\/media\\/ext4/dumpfreq", 0), "rootfs device not found");
	succeed_if (strcmp ("0", keyValue (key)) == 0, "dumpfreq not correct");

	ksDel (ks);
	keyDel (parentKey);

	PLUGIN_CLOSE ();
}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:30,代码来源:testmod_fstab.c


示例6: test_differentMetaNames

void test_differentMetaNames () {
	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:tryge,项目名称:libelektra,代码行数:28,代码来源:testmod_keytometa.c


示例7: 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


示例8: test_mmap_metacopy

static void test_mmap_metacopy (const char * tmpFile)
{
	Key * parentKey = keyNew (TEST_ROOT_KEY, KEY_VALUE, tmpFile, KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("mmapstorage");
	KeySet * ks = metaTestKeySet ();

	Key * shareMeta = keyNew (0);
	keySetMeta (shareMeta, "sharedmeta", "shared meta key test");

	Key * current;
	ksRewind (ks);
	while ((current = ksNext (ks)) != 0)
	{
		keyCopyMeta (current, shareMeta, "sharedmeta");
	}
	KeySet * expected = ksDeepDup (ks);


	succeed_if (plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful");

	KeySet * returned = ksNew (0, KS_END);
	succeed_if (plugin->kdbGet (plugin, returned, parentKey) == 1, "kdbGet was not successful");


	compare_keyset (expected, returned);

	ksDel (expected);
	ksDel (returned);

	keyDel (parentKey);
	keyDel (shareMeta);
	ksDel (ks);
	PLUGIN_CLOSE ();
}
开发者ID:sanssecours,项目名称:libelektra,代码行数:35,代码来源:testmod_mmapstorage.c


示例9: 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


示例10: 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


示例11: test_readPref

static void test_readPref (char * fileName)
{
	Key * parentKey = keyNew ("user/tests/pref-read", KEY_VALUE, srcdir_file (fileName), KEY_END);
	KeySet * conf = ksNew (0, KS_END);

	PLUGIN_OPEN ("mozprefs");

	KeySet * ks = ksNew (0, KS_END);

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	Key * key = ksLookupByName (ks, "user/tests/pref-read/user/a/user/key", KDB_O_NONE);
	exit_if_fail (key, "Key a.user.key not found");
	succeed_if (!strcmp (keyString (key), "usertest"), "Key a.user.key contains invalid data");
	key = ksLookupByName (ks, "user/tests/pref-read/lock/a/lock/key", KDB_O_NONE);
	exit_if_fail (key, "Key a.lock.key not found");
	succeed_if (!strcmp (keyString (key), "true"), "Key a.lock.key contains invalid data");
	key = ksLookupByName (ks, "user/tests/pref-read/pref/a/default/key", KDB_O_NONE);
	exit_if_fail (key, "Key a.default.key not found");
	succeed_if (!strcmp (keyString (key), "1"), "Key a.default.key contains invalid data");
	key = ksLookupByName (ks, "user/tests/pref-read/sticky/a/sticky/key", KDB_O_NONE);
	exit_if_fail (key, "Key a.sticky.key not found");
	succeed_if (!strcmp (keyString (key), "false"), "Key a.sticky.key contains invalid data");
	ksDel (ks);
	keyDel (parentKey);
	PLUGIN_CLOSE ();
}
开发者ID:reox,项目名称:libelektra,代码行数:26,代码来源:testmod_mozprefs.c


示例12: 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


示例13: testreadwritecomplicated

static void testreadwritecomplicated (const char * file)
{
	Key * parentKey = keyNew ("user/tests/csvstorage", KEY_VALUE, srcdir_file (file), KEY_END);
	KeySet * conf = ksNew (10, keyNew ("system/delimiter", KEY_VALUE, ";", KEY_END),
			       keyNew ("system/header", KEY_VALUE, "colname", KEY_END), KS_END);
	KeySet * ks = ksNew (0, KS_END);
	PLUGIN_OPEN ("csvstorage");
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) > 0, "call to kdbGet was not successful");
	succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#1/col3", KDB_O_NONE)), "l1;c3"),
		    "key value doesn't match expected value");
	succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#1/col4", KDB_O_NONE)), "l1\"\"c4"),
		    "key value doesn't match expected value");
	succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#2/col3", KDB_O_NONE)), "l2\nc3"),
		    "key value doesn't match expected value");
	succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#4/col4", KDB_O_NONE)), "l4\"\"c4"),
		    "key value doesn't match expected value");
	succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#5/col3", KDB_O_NONE)), "l5\"\"\nc3"),
		    "key value doesn't match expected value");

	keySetString (parentKey, elektraFilename ());
	succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 0, "error: wrote invalid data");
	succeed_if (compare_line_files (srcdir_file (file), keyString (parentKey)), "files do not match as expected");

	ksDel (ks);
	keyDel (parentKey);
	PLUGIN_CLOSE ();
}
开发者ID:reox,项目名称:libelektra,代码行数:27,代码来源:testmod_csvstorage.c


示例14: test_mmap_ks_copy_with_meta

static void test_mmap_ks_copy_with_meta (const char * tmpFile)
{
	Key * parentKey = keyNew (TEST_ROOT_KEY, KEY_VALUE, tmpFile, KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("mmapstorage");
	KeySet * ks = metaTestKeySet ();
	succeed_if (plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful");
	ksDel (ks);

	KeySet * returned = ksNew (0, KS_END);

	succeed_if (plugin->kdbGet (plugin, returned, parentKey) == 1, "kdbGet was not successful");

	KeySet * expected = metaTestKeySet ();
	compare_keyset (expected, returned);

	KeySet * copiedKs = ksNew (0, KS_END);
	ksCopy (copiedKs, returned);
	compare_keyset (expected, copiedKs);

	ksDel (copiedKs);
	ksDel (expected);
	ksDel (returned);

	keyDel (parentKey);
	PLUGIN_CLOSE ();
}
开发者ID:sanssecours,项目名称:libelektra,代码行数:27,代码来源:testmod_mmapstorage.c


示例15: test_readline

void test_readline(){

	char * filename = srcdir_file("line/linetest");
	Key * parentKey = keyNew ("user/tests/line", KEY_VALUE, filename, KEY_END);
	KeySet *conf = 0;
	PLUGIN_OPEN("line");
	printf("%s\n", filename);

	KeySet *ks=ksNew(0, KS_END);
	succeed_if (plugin->kdbGet(plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	Key *key = ksLookupByName(ks, "user/tests/line/#0", 0);
	exit_if_fail (key, "line1 key not found");
	succeed_if (strcmp("test1", keyValue(key)) == 0, "line ´ does not match");

	key = ksLookupByName(ks, "user/tests/line/#_10", 0);
	exit_if_fail (key, "line11 key not found");
	succeed_if (strcmp("", keyValue(key)) == 0, "line 10 should be blank");

	key = ksLookupByName(ks, "user/tests/line/#_13", 0);
	exit_if_fail (key, "line14 key not found");
	succeed_if (strcmp("printf(\"hello world\\n\");", keyValue(key)) == 0, "line 13 not correct");

	ksDel (ks);
	keyDel(parentKey);

	PLUGIN_CLOSE();
}
开发者ID:tryge,项目名称:libelektra,代码行数:27,代码来源:testmod_line.c


示例16: test_structure

void test_structure (void)
{
	printf ("Test structure of keys returned from uname plugin");

	Key * parentKey = keyNew ("user/test/key", KEY_END);
	KeySet * keys = ksNew (0, KS_END);
	KeySet * conf = 0;

	PLUGIN_OPEN ("uname");

	succeed_if (plugin->kdbGet (plugin, keys, parentKey) == 1, "could not call kdbGet");

	succeed_if (ksGetSize (keys) == 6, "size not correct");
	succeed_if (ksLookupByName (keys, "user/test/key", 0), "parentkey not found");
	succeed_if (ksLookupByName (keys, "user/test/key/sysname", 0), "sysname key not found");
	succeed_if (ksLookupByName (keys, "user/test/key/nodename", 0), "nodename key not found");
	succeed_if (ksLookupByName (keys, "user/test/key/release", 0), "release key not found");
	succeed_if (ksLookupByName (keys, "user/test/key/version", 0), "version key not found");
	succeed_if (ksLookupByName (keys, "user/test/key/machine", 0), "machine key not found");

	ksDel (keys);
	keyDel (parentKey);

	PLUGIN_CLOSE ();
}
开发者ID:0003088,项目名称:libelektra,代码行数:25,代码来源:testmod_uname.c


示例17: 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


示例18: test_replaceString

static void test_replaceString()
{
	Key *parentKey = keyNew("user/tests/rename", KEY_END);
	KeySet *conf = ksNew(20, 
			keyNew("system/cut", KEY_VALUE, "will/be/stripped", KEY_END),
			keyNew("system/replacewith", KEY_VALUE, "stripped/it/is", KEY_END),
			KS_END);
	
	KeySet *ks = createSimpleTestKeys();
	ksAppendKey(ks, parentKey);

	PLUGIN_OPEN("rename");

	succeed_if(plugin->kdbGet(plugin, ks, parentKey) >= 1,
			"call to kdbGet was not successful");
	Key *key = ksLookupByName(ks, "user/tests/rename/stripped/it/is/key1", KDB_O_NONE);
	succeed_if(key, "key1 was not correctly rename");
	key = ksLookupByName(ks, "user/tests/rename/stripped/it/is/key2", KDB_O_NONE);
	succeed_if(key, "key2 was not correctly rename");
	key = ksLookupByName(ks, "user/tests/rename/will/not/be/stripped/key4", KDB_O_NONE);
	succeed_if(key, "key4 was not correctly rename");
	
	keyDel(parentKey);
	ksDel(ks);
	PLUGIN_CLOSE();

}
开发者ID:tryge,项目名称:libelektra,代码行数:27,代码来源:testmod_rename.c


示例19: 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


示例20: test_appendSameLevel

void test_appendSameLevel () {
	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:tryge,项目名称:libelektra,代码行数:32,代码来源:testmod_keytometa.c



注:本文中的PLUGIN_OPEN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PL_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ PLUGIN_MAKE_VERSION函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap