diff options
author | Colin Walters <walters@verbum.org> | 2010-12-04 15:48:00 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-12-10 14:12:51 -0500 |
commit | 70ba6dfc6fc80de0f1300cf9b35d0b66d60d31b9 (patch) | |
tree | 20c08dc05a5b6fae19cc481086d0dc88c9e36d23 | |
parent | f4cb2b72053b829c2903c7c54e44d6105b005381 (diff) | |
download | gjs-70ba6dfc6fc80de0f1300cf9b35d0b66d60d31b9.tar.gz |
gjs-unit: Pull in JS version from header in tests; add version to tests
For now, explicitly specify all tests as being "application/javascript;version=1.8".
We will back down some of the tests to default soon.
https://bugzilla.gnome.org/show_bug.cgi?id=636652
-rw-r--r-- | test/gjs-unit.c | 9 | ||||
-rw-r--r-- | test/js/modules/alwaysThrows.js | 1 | ||||
-rw-r--r-- | test/js/modules/foobar.js | 1 | ||||
-rw-r--r-- | test/js/modules/mutualImport/a.js | 1 | ||||
-rw-r--r-- | test/js/modules/mutualImport/b.js | 1 | ||||
-rw-r--r-- | test/js/modules/subA/subB/__init__.js | 1 | ||||
-rw-r--r-- | test/js/modules/subA/subB/foobar.js | 1 | ||||
-rw-r--r-- | test/js/test0010basic.js | 1 | ||||
-rw-r--r-- | test/js/test0020importer.js | 1 | ||||
-rw-r--r-- | test/js/test0030basicBoxed.js | 1 | ||||
-rw-r--r-- | test/js/test0040mainloop.js | 1 | ||||
-rw-r--r-- | test/js/testByteArray.js | 1 | ||||
-rw-r--r-- | test/js/testCairo.js | 1 | ||||
-rw-r--r-- | test/js/testDbus.js | 1 | ||||
-rw-r--r-- | test/js/testEverythingBasic.js | 1 | ||||
-rw-r--r-- | test/js/testEverythingEncapsulated.js | 1 | ||||
-rw-r--r-- | test/js/testGI.js | 1 | ||||
-rw-r--r-- | test/js/testGIMarshalling.js | 1 | ||||
-rw-r--r-- | test/js/testImporter.js | 1 | ||||
-rw-r--r-- | test/js/testLang.js | 1 | ||||
-rw-r--r-- | test/js/testLocale.js | 1 | ||||
-rw-r--r-- | test/js/testMainloop.js | 1 | ||||
-rw-r--r-- | test/js/testSignals.js | 1 | ||||
-rw-r--r-- | test/js/testTweener.js | 1 | ||||
-rw-r--r-- | test/js/testself.js | 1 |
25 files changed, 32 insertions, 1 deletions
diff --git a/test/gjs-unit.c b/test/gjs-unit.c index 1b561c78..c605bf89 100644 --- a/test/gjs-unit.c +++ b/test/gjs-unit.c @@ -47,11 +47,18 @@ setup(GjsTestJSFixture *fix, int code; char *filename; char *search_path[2]; + const char *test_filename = test_data; + const char *js_version; + + js_version = gjs_context_scan_file_for_js_version(test_filename); search_path[0] = g_build_filename(top_srcdir, "test", "modules", NULL); search_path[1] = NULL; - fix->context = gjs_context_new_with_search_path(search_path); + fix->context = g_object_new (GJS_TYPE_CONTEXT, + "search-path", search_path, + "js-version", js_version, + NULL); g_free(search_path[0]); /* Load jsUnit.js directly into global scope, rather than diff --git a/test/js/modules/alwaysThrows.js b/test/js/modules/alwaysThrows.js index 50af1ff1..cd0e9db7 100644 --- a/test/js/modules/alwaysThrows.js +++ b/test/js/modules/alwaysThrows.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // line 0 // line 1 // line 2 diff --git a/test/js/modules/foobar.js b/test/js/modules/foobar.js index cdd5cade..ab9a84c1 100644 --- a/test/js/modules/foobar.js +++ b/test/js/modules/foobar.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // simple test module (used by testImporter.js) var foo = "This is foo"; diff --git a/test/js/modules/mutualImport/a.js b/test/js/modules/mutualImport/a.js index c5fd0691..5f03f7b1 100644 --- a/test/js/modules/mutualImport/a.js +++ b/test/js/modules/mutualImport/a.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const B = imports.mutualImport.b; let count = 0; diff --git a/test/js/modules/mutualImport/b.js b/test/js/modules/mutualImport/b.js index b6443b1e..732465d5 100644 --- a/test/js/modules/mutualImport/b.js +++ b/test/js/modules/mutualImport/b.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const A = imports.mutualImport.a; function getCount() { diff --git a/test/js/modules/subA/subB/__init__.js b/test/js/modules/subA/subB/__init__.js index c7660dc1..0bab8424 100644 --- a/test/js/modules/subA/subB/__init__.js +++ b/test/js/modules/subA/subB/__init__.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 function testImporterFunction() { return "__init__ function tested"; } diff --git a/test/js/modules/subA/subB/foobar.js b/test/js/modules/subA/subB/foobar.js index cdd5cade..ab9a84c1 100644 --- a/test/js/modules/subA/subB/foobar.js +++ b/test/js/modules/subA/subB/foobar.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // simple test module (used by testImporter.js) var foo = "This is foo"; diff --git a/test/js/test0010basic.js b/test/js/test0010basic.js index 30bb07bb..47812fab 100644 --- a/test/js/test0010basic.js +++ b/test/js/test0010basic.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 function testBasic1() { var foo = 1+1; log("1 + 1 = " + foo); diff --git a/test/js/test0020importer.js b/test/js/test0020importer.js index 8ca444ef..42a33dee 100644 --- a/test/js/test0020importer.js +++ b/test/js/test0020importer.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 function testImporter1() { var GLib = imports.gi.GLib; assertEquals(GLib.MAJOR_VERSION, 2); diff --git a/test/js/test0030basicBoxed.js b/test/js/test0030basicBoxed.js index 35ec43b1..57dbbe31 100644 --- a/test/js/test0030basicBoxed.js +++ b/test/js/test0030basicBoxed.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 var Regress = imports.gi.Regress; function testBasicBoxed() { diff --git a/test/js/test0040mainloop.js b/test/js/test0040mainloop.js index e1d3479c..0b49a3f4 100644 --- a/test/js/test0040mainloop.js +++ b/test/js/test0040mainloop.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 var Mainloop = imports.mainloop; function testBasicMainloop() { diff --git a/test/js/testByteArray.js b/test/js/testByteArray.js index 3ead00de..3cfcb332 100644 --- a/test/js/testByteArray.js +++ b/test/js/testByteArray.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // tests for imports.lang module const ByteArray = imports.byteArray; diff --git a/test/js/testCairo.js b/test/js/testCairo.js index 6589179a..7dd66cc3 100644 --- a/test/js/testCairo.js +++ b/test/js/testCairo.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const Cairo = imports.cairo; function _ts(obj) { diff --git a/test/js/testDbus.js b/test/js/testDbus.js index 8f503ea5..1794040b 100644 --- a/test/js/testDbus.js +++ b/test/js/testDbus.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const DBus = imports.dbus; const Mainloop = imports.mainloop; diff --git a/test/js/testEverythingBasic.js b/test/js/testEverythingBasic.js index 0730eba5..79dcb348 100644 --- a/test/js/testEverythingBasic.js +++ b/test/js/testEverythingBasic.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // This used to be called "Everything" const Everything = imports.gi.Regress; if (!('assertEquals' in this)) { /* allow running this test standalone */ diff --git a/test/js/testEverythingEncapsulated.js b/test/js/testEverythingEncapsulated.js index 2e4a1b34..a3a6742d 100644 --- a/test/js/testEverythingEncapsulated.js +++ b/test/js/testEverythingEncapsulated.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // This used to be called "Everything" const Everything = imports.gi.Regress; if (!('assertEquals' in this)) { /* allow running this test standalone */ diff --git a/test/js/testGI.js b/test/js/testGI.js index 08852ee5..a88bd0fe 100644 --- a/test/js/testGI.js +++ b/test/js/testGI.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 function testUTF8() { const GLib = imports.gi.GLib; diff --git a/test/js/testGIMarshalling.js b/test/js/testGIMarshalling.js index 49ec4ca0..5d74e953 100644 --- a/test/js/testGIMarshalling.js +++ b/test/js/testGIMarshalling.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const GIMarshallingTests = imports.gi.GIMarshallingTests; // We use Gio to have some objects that we know exist diff --git a/test/js/testImporter.js b/test/js/testImporter.js index bd1cd4ff..50221059 100644 --- a/test/js/testImporter.js +++ b/test/js/testImporter.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 function testImporter() { assertNotUndefined(imports); diff --git a/test/js/testLang.js b/test/js/testLang.js index b78b7752..3ab34748 100644 --- a/test/js/testLang.js +++ b/test/js/testLang.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // tests for imports.lang module const Lang = imports.lang; diff --git a/test/js/testLocale.js b/test/js/testLocale.js index 214b5e6c..48ab4f98 100644 --- a/test/js/testLocale.js +++ b/test/js/testLocale.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 // tests for JS_SetLocaleCallbacks(). function testToLocaleDateString() { diff --git a/test/js/testMainloop.js b/test/js/testMainloop.js index 991f3e7e..09d22af2 100644 --- a/test/js/testMainloop.js +++ b/test/js/testMainloop.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const Mainloop = imports.mainloop; function testTimeout() { diff --git a/test/js/testSignals.js b/test/js/testSignals.js index 9cfdd8f9..30bd2542 100644 --- a/test/js/testSignals.js +++ b/test/js/testSignals.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const Signals = imports.signals; function Foo() { diff --git a/test/js/testTweener.js b/test/js/testTweener.js index ec22a004..67618758 100644 --- a/test/js/testTweener.js +++ b/test/js/testTweener.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 const Tweener = imports.tweener.tweener; const Mainloop = imports.mainloop; diff --git a/test/js/testself.js b/test/js/testself.js index f9df73a8..918a6d92 100644 --- a/test/js/testself.js +++ b/test/js/testself.js @@ -1,3 +1,4 @@ +// application/javascript;version=1.8 var someUndefined; var someNumber = 1; var someOtherNumber = 42; |