Exemplo n.º 1
0
void t17_merge(){
	INIT_LOCAL();

	onion_dict *a=onion_dict_from_json("{\"hello\":\"world\"}");
	onion_dict *b=onion_dict_from_json("{\"bye\":\"_world_\", \"sub\": { \"hello\": \"world!\" } }");

	onion_dict_merge(a,b);

	FAIL_IF_NOT_EQUAL_STR(onion_dict_get(a,"bye"), "_world_");
	FAIL_IF_NOT_EQUAL_STR(onion_dict_rget(a,"sub","hello",NULL), "world!");

	onion_dict_free(b);
	FAIL_IF_NOT_EQUAL_STR(onion_dict_rget(a,"sub","hello",NULL), "world!");
	onion_dict_free(a);

	END_LOCAL();
}
Exemplo n.º 2
0
		/**
		 * @short Merges argument dict into current.
		 * 
		 * If there are repeated keys, they will repeated.
		 */
		Dict &merge(const ::Onion::Dict &other){
			onion_dict_merge(ptr, other.ptr);
			return *this;
		}