[asterisk-commits] mjordan: trunk r397571 - /trunk/tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 23 13:10:13 CDT 2013


Author: mjordan
Date: Fri Aug 23 13:10:11 2013
New Revision: 397571

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397571
Log:
Fix sorcery unit tests

When strict XML documentation checking was re-enabled, the test objects used in
sorcery would fail to register as the types were not marked internal and the
nodoc option wasn't used for the options. This fixes that problem, such that,
as one would hope, they once again pass.

Modified:
    trunk/tests/test_sorcery.c
    trunk/tests/test_sorcery_astdb.c
    trunk/tests/test_sorcery_realtime.c

Modified: trunk/tests/test_sorcery.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_sorcery.c?view=diff&rev=397571&r1=397570&r2=397571
==============================================================================
--- trunk/tests/test_sorcery.c (original)
+++ trunk/tests/test_sorcery.c Fri Aug 23 13:10:11 2013
@@ -243,13 +243,13 @@
 	}
 
 	if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
-		ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+		ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_sorcery_unref(sorcery);
 		return NULL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	return sorcery;
 }
@@ -424,12 +424,12 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	if (!ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (!ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Registered object type a second time, despite it being registered already\n");
 		return AST_TEST_FAIL;
 	}
@@ -458,7 +458,7 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (!ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (!ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Registered object type when no object mapping exists\n");
 		return AST_TEST_FAIL;
 	}
@@ -487,7 +487,7 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (!ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob))) {
+	if (!ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob))) {
 		ast_test_status_update(test, "Registered an object field successfully when no mappings or object types exist\n");
 		return AST_TEST_FAIL;
 	}
@@ -497,17 +497,17 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (!ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob))) {
+	if (!ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob))) {
 		ast_test_status_update(test, "Registered an object field successfully when object type does not exist\n");
 		return AST_TEST_FAIL;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	if (ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob))) {
+	if (ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob))) {
 		ast_test_status_update(test, "Could not successfully register object field when mapping and object type exists\n");
 		return AST_TEST_FAIL;
 	}
@@ -551,7 +551,7 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
@@ -1013,7 +1013,7 @@
 	}
 
 	if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
-	    ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
+	    ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
 		ast_test_status_update(test, "Failed to register 'test' object type\n");
 		return AST_TEST_FAIL;
 	}
@@ -1113,13 +1113,13 @@
 	}
 
 	if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
-	    ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
+	    ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
 		ast_test_status_update(test, "Failed to register 'test' object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	if (!(obj = ast_sorcery_alloc(sorcery, "test", "blah"))) {
 		ast_test_status_update(test, "Failed to allocate a known object type\n");
@@ -1212,13 +1212,13 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, test_sorcery_transform, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, test_sorcery_transform, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	if (!(obj = ast_sorcery_alloc(sorcery, "test", "blah"))) {
 		ast_test_status_update(test, "Failed to allocate a known object type\n");
@@ -1274,7 +1274,7 @@
 	}
 
 	if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
-	    ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
+	    ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
 		ast_test_status_update(test, "Failed to register 'test' object type\n");
 		return AST_TEST_FAIL;
 	}
@@ -2069,7 +2069,7 @@
 		goto end;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		goto end;
 	}
@@ -2314,13 +2314,13 @@
 		return AST_TEST_NOT_RUN;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	ast_sorcery_load(sorcery);
 
@@ -2377,13 +2377,13 @@
 		return AST_TEST_NOT_RUN;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	ast_sorcery_load(sorcery);
 
@@ -2431,14 +2431,14 @@
 		return AST_TEST_NOT_RUN;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
-	ast_sorcery_object_field_register(sorcery, "test", "type", NULL, OPT_NOOP_T, 0, NULL);
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "type", NULL, OPT_NOOP_T, 0, NULL);
 
 	ast_sorcery_load(sorcery);
 
@@ -2490,13 +2490,13 @@
 		return AST_TEST_NOT_RUN;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	ast_sorcery_load(sorcery);
 
@@ -2553,13 +2553,13 @@
 		return AST_TEST_NOT_RUN;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	ast_sorcery_load(sorcery);
 
@@ -2624,13 +2624,13 @@
 		return AST_TEST_NOT_RUN;
 	}
 
-	if (ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+	if (ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_test_status_update(test, "Failed to register object type\n");
 		return AST_TEST_FAIL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	ast_sorcery_load(sorcery);
 

Modified: trunk/tests/test_sorcery_astdb.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_sorcery_astdb.c?view=diff&rev=397571&r1=397570&r2=397571
==============================================================================
--- trunk/tests/test_sorcery_astdb.c (original)
+++ trunk/tests/test_sorcery_astdb.c Fri Aug 23 13:10:11 2013
@@ -61,13 +61,13 @@
 	}
 
 	if (ast_sorcery_apply_default(sorcery, "test", "astdb", "test") ||
-		ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
+		ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
 		ast_sorcery_unref(sorcery);
 		return NULL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	return sorcery;
 }

Modified: trunk/tests/test_sorcery_realtime.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_sorcery_realtime.c?view=diff&rev=397571&r1=397570&r2=397571
==============================================================================
--- trunk/tests/test_sorcery_realtime.c (original)
+++ trunk/tests/test_sorcery_realtime.c Fri Aug 23 13:10:11 2013
@@ -213,14 +213,14 @@
 	}
 
 	if (ast_sorcery_apply_default(sorcery, "test", "realtime", "sorcery_realtime_test") ||
-		ast_sorcery_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL) ||
+		ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL) ||
 		!(realtime_objects = ast_config_new())) {
 		ast_sorcery_unref(sorcery);
 		return NULL;
 	}
 
-	ast_sorcery_object_field_register(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
-	ast_sorcery_object_field_register(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "bob", "5", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, bob));
+	ast_sorcery_object_field_register_nodoc(sorcery, "test", "joe", "10", OPT_UINT_T, 0, FLDSET(struct test_sorcery_object, joe));
 
 	return sorcery;
 }




More information about the asterisk-commits mailing list