[gnome-js-common] Tests: Run all of the tests, don't exit after the first failure.



commit 2f7446a9fff8c8c835b4ac9edb7ca7b714f896f7
Author: Tim Horton <hortont424 gmail com>
Date:   Wed May 27 04:21:58 2009 -0400

    Tests: Run all of the tests, don't exit after the first failure.
---
 Makefile.am                             |   13 ++++++-------
 tests/{run-tests.c => run-tests-seed.c} |   19 ++++++++++---------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1268e68..6d9b997 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,15 +1,14 @@
-SUBDIRS = po modules
+SUBDIRS = po modules tests
 
 gnome_js_commondocdir = ${prefix}/doc/gnome_js_common
 gnome_js_commondoc_DATA = \
-	README\
-	COPYING\
-	AUTHORS\
-	ChangeLog\
-	INSTALL\
+	README \
+	COPYING \
+	AUTHORS \
+	ChangeLog \
+	INSTALL \
 	NEWS
 
-
 INTLTOOL_FILES = intltool-extract.in \
 	intltool-merge.in \
 	intltool-update.in
diff --git a/tests/run-tests.c b/tests/run-tests-seed.c
similarity index 83%
rename from tests/run-tests.c
rename to tests/run-tests-seed.c
index bc37ea9..b51ffa4 100644
--- a/tests/run-tests.c
+++ b/tests/run-tests-seed.c
@@ -20,7 +20,7 @@ SeedValue js_assert(SeedContext ctx,
 		seed_make_exception(ctx, exception, "AssertionError", "Assertion failed");
 }
 
-void test_exec(gchar * filename)
+gboolean test_exec(gchar * filename)
 {
 	SeedObject global;
 	SeedScript * script;
@@ -52,15 +52,16 @@ void test_exec(gchar * filename)
 	
 	if((e = seed_script_exception(script)))
 	{
-		g_critical("FAIL\n\t%s. %s in %s at line %d\n",
-			seed_exception_get_name (eng->context, e),
-			seed_exception_get_message (eng->context, e),
-			seed_exception_get_file (eng->context, e),
-			seed_exception_get_line (eng->context, e));
-		exit(1);
+		printf("%s... FAIL (%s: line %d)\n",
+			filename,
+			seed_exception_get_name(eng->context, e),
+			seed_exception_get_line(eng->context, e));
+		return FALSE;
 	}
 
 	g_free(script);
+	
+	return TRUE;
 }
 
 void run_tests(gchar * tests_dir_name)
@@ -77,8 +78,8 @@ void run_tests(gchar * tests_dir_name)
 		
 		test_path = g_build_filename(tests_dir_name, test_name, NULL);
 
-		test_exec((char*)test_path);
-		printf("%s... OK\n", test_path);
+		if(test_exec((char*)test_path))
+			printf("%s... OK\n", test_path);
 	}
 	
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]