[gnome-js-common] Tests: Add previously-mentioned shared testing file.



commit bc17ad3db1cc52503afaa6a5f3f4a417c9fdff9f
Author: Tim Horton <hortont424 gmail com>
Date:   Wed May 27 06:05:26 2009 -0400

    Tests: Add previously-mentioned shared testing file.
---
 tests/run-tests.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/tests/run-tests.c b/tests/run-tests.c
new file mode 100644
index 0000000..061f1e8
--- /dev/null
+++ b/tests/run-tests.c
@@ -0,0 +1,45 @@
+/*
+ * -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- 
+ */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+gboolean failure_flag = FALSE;
+
+void run_tests(gchar * tests_dir_name)
+{
+	GDir * tests_dir;
+	const gchar * test_name;
+	const gchar * test_path;
+	
+	tests_dir = g_dir_open(tests_dir_name, 0, NULL);
+	while((test_name = g_dir_read_name(tests_dir)) != NULL)
+	{
+		if(!g_str_has_suffix(test_name, ".js")) // TODO: casing problem
+			continue;
+		
+		test_path = g_build_filename(tests_dir_name, test_name, NULL);
+
+		if(test_exec((char*)test_path))
+			printf("%s... OK\n", test_path);
+	}
+	
+}
+
+int main(int argc, char ** argv)
+{
+	if(argc == 1)
+		run_tests(".");
+	else
+	{
+		int i;
+		
+		for(i = 1; i < argc; i++)
+			run_tests(argv[i]);
+	}
+	
+	return failure_flag;
+}
+



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