[asterisk-commits] dlee: branch dlee/stasis-http r379112 - /team/dlee/stasis-http/tests/test_json.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 15 09:21:51 CST 2013
Author: dlee
Date: Tue Jan 15 09:21:48 2013
New Revision: 379112
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379112
Log:
Test object ownership with ast_json_pack
Modified:
team/dlee/stasis-http/tests/test_json.c
Modified: team/dlee/stasis-http/tests/test_json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/tests/test_json.c?view=diff&rev=379112&r1=379111&r2=379112
==============================================================================
--- team/dlee/stasis-http/tests/test_json.c (original)
+++ team/dlee/stasis-http/tests/test_json.c Tue Jan 15 09:21:48 2013
@@ -1402,6 +1402,27 @@
uut = ast_json_pack("[[i,i],{s:b}]", 1, 2, "cool", 1);
ast_test_validate(test, NULL != uut);
ast_test_validate(test, ast_json_equal(expected, uut));
+
+ return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_pack_ownership)
+{
+ RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+ RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+ switch (cmd) {
+ case TEST_INIT:
+ info->name = "pack_ownership";
+ info->category = "/main/json/";
+ info->summary = "Testing json_pack failure conditions.";
+ info->description = "Test JSON abstraction library.";
+ return AST_TEST_NOT_RUN;
+ case TEST_EXECUTE:
+ break;
+ }
+
+ uut = ast_json_pack("[o]", ast_json_string_create("Am I freed?"));
return AST_TEST_PASS;
}
@@ -1636,6 +1657,7 @@
AST_TEST_UNREGISTER(json_test_dump_load_null);
AST_TEST_UNREGISTER(json_test_parse_errors);
AST_TEST_UNREGISTER(json_test_pack);
+ AST_TEST_UNREGISTER(json_test_pack_ownership);
AST_TEST_UNREGISTER(json_test_pack_errors);
AST_TEST_UNREGISTER(json_test_copy);
AST_TEST_UNREGISTER(json_test_deep_copy);
@@ -1688,6 +1710,7 @@
AST_TEST_REGISTER(json_test_dump_load_null);
AST_TEST_REGISTER(json_test_parse_errors);
AST_TEST_REGISTER(json_test_pack);
+ AST_TEST_REGISTER(json_test_pack_ownership);
AST_TEST_REGISTER(json_test_pack_errors);
AST_TEST_REGISTER(json_test_copy);
AST_TEST_REGISTER(json_test_deep_copy);
More information about the asterisk-commits
mailing list