[gjs/xulrunner-1.9.3-rebase3: 3/10] tests: Add a test case for basic context creation/destruction



commit 7ca230810d1ff05fd07ee35edb2702d92ba8e0b6
Author: Colin Walters <walters verbum org>
Date:   Mon Sep 20 11:25:58 2010 -0400

    tests: Add a test case for basic context creation/destruction
    
    Trying to narrow down a XULRunner 1.9.3 hang, and didn't see
    this simple test case anywhere else.

 Makefile.am   |    1 +
 gjs/context.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 48e6dc6..f12fd70 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,6 +90,7 @@ libgjs_la_SOURCES =		\
 	util/misc.c
 
 gjstest_files_with_tests += 	\
+	gjs/context.c		\
 	gjs/jsapi-util-array.c	\
 	gjs/jsapi-util-error.c	\
 	gjs/jsapi-util-string.c	\
diff --git a/gjs/context.c b/gjs/context.c
index 635e31d..fa23ad5 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -962,3 +962,31 @@ gjs_context_define_string_array(GjsContext  *js_context,
     return TRUE;
 }
 
+#if GJS_BUILD_TESTS
+
+void
+gjstest_test_func_gjs_context_construct_destroy(void)
+{
+    GjsContext *context;
+
+    context = gjs_context_new ();
+    g_object_unref (context);
+
+    context = gjs_context_new ();
+    g_object_unref (context);
+}
+
+void
+gjstest_test_func_gjs_context_construct_eval(void)
+{
+    GjsContext *context;
+    int estatus;
+    GError *error = NULL;
+
+    context = gjs_context_new ();
+    if (!gjs_context_eval (context, "1+1", -1, "<input>", &estatus, &error))
+        g_error ("%s", error->message);
+    g_object_unref (context);
+}
+
+#endif /* GJS_BUILD_TESTS */



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