diff options
author | Colin Walters <walters@verbum.org> | 2010-09-20 11:25:58 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-09-20 16:04:23 -0400 |
commit | 6447a30d79a5352e06214e6f45c5f4a61a414388 (patch) | |
tree | c34c28613657ba4dd40503f05332a58d49f222a2 | |
parent | d502d48e0161fec4306dc951ea7e64e8ff0b326c (diff) | |
download | gjs-6447a30d79a5352e06214e6f45c5f4a61a414388.tar.gz |
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.
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | gjs/context.c | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 48e6dc65..f12fd707 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 635e31d1..fa23ad5b 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 */ |