void gjstest_test_func_gjs_context_construct_destroy(void) { GjsContext *context; /* Construct twice just to possibly a case where global state from * the first leaks. */ context = gjs_context_new (); g_object_unref (context); context = gjs_context_new (); g_object_unref (context); }
static void _gjs_unit_test_fixture_begin (GjsUnitTestFixture *fixture) { fixture->gjs_context = gjs_context_new (); fixture->context = (JSContext *) gjs_context_get_native_context (fixture->gjs_context); JS_BeginRequest(fixture->context); JS_SetErrorReporter(fixture->context, test_error_reporter); }
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); }
static void initialize (EthosPluginLoader *plugin_loader, EthosManager *manager) { EthosJSPluginLoaderPrivate *priv; g_return_if_fail (ETHOS_IS_JS_PLUGIN_LOADER (plugin_loader)); priv = ETHOS_JS_PLUGIN_LOADER (plugin_loader)->priv; priv->context = gjs_context_new (); }
void gjstest_test_func_gjs_stack_dump(void) { GjsContext *context; /* TODO this test could be better - maybe expose dumpstack as a JS API * so that we have a JS stack to dump? At least here we're getting some * coverage. */ context = gjs_context_new(); gjs_dumpstack(); g_object_unref(context); gjs_dumpstack(); }
static void setup(GjsTestJSFixture *fix, gconstpointer test_data) { GjsTestData *data = (GjsTestData *) test_data; fix->context = gjs_context_new (); if (data->coverage_prefix) { const char *coverage_prefixes[2] = { data->coverage_prefix, NULL }; if (!data->coverage_output_path) { g_error("GJS_UNIT_COVERAGE_OUTPUT is required when using GJS_UNIT_COVERAGE_PREFIX"); } char *path_to_cache_file = g_build_filename(data->coverage_output_path, ".internal-coverage-cache", NULL); fix->coverage = gjs_coverage_new_from_cache((const char **) coverage_prefixes, fix->context, path_to_cache_file); g_free(path_to_cache_file); } }