[svn-commits] russell: trunk r243157 - /trunk/tests/test_substitution.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jan 26 09:35:43 CST 2010


Author: russell
Date: Tue Jan 26 09:35:40 2010
New Revision: 243157

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=243157
Log:
Update test_substitution to show failures in the test log.

Modified:
    trunk/tests/test_substitution.c

Modified: trunk/tests/test_substitution.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_substitution.c?view=diff&rev=243157&r1=243156&r2=243157
==============================================================================
--- trunk/tests/test_substitution.c (original)
+++ trunk/tests/test_substitution.c Tue Jan 26 09:35:40 2010
@@ -58,6 +58,9 @@
 		pbx_substitute_variables_helper(c, expression, workspace, sizeof(workspace));
 		if (sscanf(workspace, "%d", &value1) != 1 || value1 != i || sscanf(ast_str_buffer(str), "%d", &value2) != 1 || value2 != i) {
 			ast_test_status_update(status, "%s != %s and/or %d != %d != %d\n", ast_str_buffer(str), workspace, value1, value2, i);
+			ast_str_set(err, 0, "%s: '%s' != '%s' and/or %d != %d != %d\n",
+					__PRETTY_FUNCTION__, ast_str_buffer(str),
+					workspace, value1, value2, i);
 			okay = 0;
 		}
 	}
@@ -83,6 +86,8 @@
 		ast_test_status_update(status, "Testing '%s' . . . . . %s\n", expression, okay ? "passed" : "FAILED");
 		if (strcmp(cfield, ast_str_buffer(str)) != 0 || strcmp(cfield, workspace) != 0) {
 			ast_test_status_update(status, "%s != %s != %s\n", cfield, ast_str_buffer(str), workspace);
+			ast_str_set(err, 0, "%s: '%s' != '%s' != '%s'\n",
+					__PRETTY_FUNCTION__, cfield, ast_str_buffer(str), workspace);
 			okay = 0;
 		}
 	}
@@ -109,6 +114,8 @@
 		ast_test_status_update(status, "Testing '%s' . . . . . %s\n", ast_str_buffer(var), okay ? "passed" : "FAILED");
 		if (strcmp(values[i], ast_str_buffer(str)) != 0 || strcmp(values[i], workspace) != 0) {
 			ast_test_status_update(status, "%s != %s != %s\n", values[i], ast_str_buffer(str), workspace);
+			ast_str_set(err, 0, "%s: '%s' != '%s' != '%s'\n",
+					__PRETTY_FUNCTION__, values[i], ast_str_buffer(str), workspace);
 			okay = 0;
 		}
 	}
@@ -132,6 +139,8 @@
 	if (strcmp(workspace, ast_str_buffer(str)) != 0) {
 		ast_test_status_update(status, "test_chan_function, expr: '%s' ... %s != %s\n",
 				expression, ast_str_buffer(str), workspace);
+		ast_str_set(err, 0, "%s: expr: '%s' ... '%s' != '%s'\n",
+				__PRETTY_FUNCTION__, expression, ast_str_buffer(str), workspace);
 		okay = 0;
 	}
 
@@ -154,12 +163,14 @@
 
 	okay = !strcmp(ast_str_buffer(str), "foobarbaz");
 
-	ast_test_status_update(status, "Testing '%s%s' and '%s%s' . . . . . %s\n", 
-			encode1, encode2, decode1, decode2, 
+	ast_test_status_update(status, "Testing '%s%s' and '%s%s' . . . . . %s\n",
+			encode1, encode2, decode1, decode2,
 			okay ? "passed" : "FAILED");
 
 	if (!okay) {
 		ast_test_status_update(status, "  '%s' != 'foobarbaz'\n", ast_str_buffer(str));
+		ast_str_set(err, 0, "%s: '%s' != 'foobarbaz'\n",
+				__PRETTY_FUNCTION__, ast_str_buffer(str));
 	}
 
 	ast_free(str);
@@ -182,6 +193,8 @@
 
 	if (!okay) {
 		ast_test_status_update(status, "test_expected_result: '%s' != '%s'\n",
+				ast_str_buffer(str), result);
+		ast_str_set(err, 0, "%s: '%s' != '%s'\n", __PRETTY_FUNCTION__,
 				ast_str_buffer(str), result);
 	}
 




More information about the svn-commits mailing list