[gnome-js-common] Tests: Beginnings of GJS test.



commit 7bf0352d43c58fb845d6f46c489b0f51aa99fbe1
Author: Tim Horton <hortont424 gmail com>
Date:   Wed May 27 06:11:28 2009 -0400

    Tests: Beginnings of GJS test.
---
 configure.ac          |    2 +-
 tests/Makefile.am     |   16 ++++++++++++++++
 tests/run-tests-gjs.c |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 594d412..177cd71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ AC_ARG_ENABLE(gjs,
 	[want_gjs=$enableval],[want_gjs="yes"])
 
 if test x"$want_gjs" == x"yes" ; then
-   PKG_CHECK_MODULES(GJS, gjs-1.0)
+   PKG_CHECK_MODULES(GJS, gjs-1.0 gjs-gi-1.0)
    AC_SUBST(GJS_CFLAGS)
    AC_SUBST(GJS_LDFLAGS)
 fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6937379..f04d2bc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,3 +18,19 @@ run_tests_seed_LDFLAGS = \
 	$(SEED_LIBS)
 
 endif
+
+if HAVE_GJS
+
+check_PROGRAMS += run-tests-gjs
+TESTS += run-tests-gjs
+
+run_tests_gjs_SOURCES = run-tests-gjs.c run-tests.c
+
+run_tests_gjs_CFLAGS = \
+	-Wall \
+	$(GJS_CFLAGS)
+
+run_tests_gjs_LDFLAGS = \
+	$(GJS_LIBS)
+
+endif
diff --git a/tests/run-tests-gjs.c b/tests/run-tests-gjs.c
new file mode 100644
index 0000000..bc916f8
--- /dev/null
+++ b/tests/run-tests-gjs.c
@@ -0,0 +1,38 @@
+/*
+ * -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- 
+ */
+
+#include <glib.h>
+#include <gjs/gjs.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+gboolean initialized = FALSE;
+extern gboolean failure_flag;
+
+/*SeedValue js_assert(SeedContext ctx,
+                    SeedObject function,
+                    SeedObject this_object,
+                    size_t argument_count,
+                    const SeedValue arguments[],
+                    SeedException * exception)
+{
+	if(!seed_value_to_boolean(ctx, arguments[0], NULL))
+		seed_make_exception(ctx, exception, "AssertionError", "Assertion failed");
+}*/
+
+gboolean test_exec(gchar * filename)
+{
+	gchar * buffer;
+	
+	if(!initialized)
+	{
+		// init gjs
+		initialized = TRUE;
+	}
+
+	// eval filename in a new context, discard context, check errors etc.
+	
+	return TRUE;
+}
+



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