summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-09-20 13:32:59 -0400
committerColin Walters <walters@verbum.org>2010-09-23 14:06:53 -0400
commitd03a5c363c457ecc6026b72e402b41168bb50eda (patch)
tree06693deff66ba3e2d92f495697a5314a6adc7071
parenta7fe6a8daf60d3db035d30dc8a106f888b5e83fc (diff)
downloadgjs-d03a5c363c457ecc6026b72e402b41168bb50eda.tar.gz
tests: Add a few early basic tests
These very simple js tests exercise the basic infrastructure, before we drop into more complex unit tests. Added for XULRunner 1.9.3 porting. https://bugzilla.gnome.org/show_bug.cgi?id=630413
-rw-r--r--Makefile-test.am4
-rw-r--r--test/js/test0010basic.js6
-rw-r--r--test/js/test0020importer.js6
-rw-r--r--test/js/test0030basicBoxed.js8
-rw-r--r--test/js/test0040mainloop.js15
5 files changed, 39 insertions, 0 deletions
diff --git a/Makefile-test.am b/Makefile-test.am
index a05e8aa4..eda994d5 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -160,6 +160,10 @@ EXTRA_DIST += \
test/js/modules/subA/subB/__init__.js \
test/js/modules/subA/subB/foobar.js \
test/js/modules/subA/subB/baz.js \
+ test/js/test0010basic.js \
+ test/js/test0020importer.js \
+ test/js/test0030basicBoxed.js \
+ test/js/test0040mainloop.js \
test/js/testself.js \
test/js/testByteArray.js \
test/js/testCairo.js \
diff --git a/test/js/test0010basic.js b/test/js/test0010basic.js
new file mode 100644
index 00000000..30bb07bb
--- /dev/null
+++ b/test/js/test0010basic.js
@@ -0,0 +1,6 @@
+function testBasic1() {
+ var foo = 1+1;
+ log("1 + 1 = " + foo);
+}
+
+gjstestRun();
diff --git a/test/js/test0020importer.js b/test/js/test0020importer.js
new file mode 100644
index 00000000..8ca444ef
--- /dev/null
+++ b/test/js/test0020importer.js
@@ -0,0 +1,6 @@
+function testImporter1() {
+ var GLib = imports.gi.GLib;
+ assertEquals(GLib.MAJOR_VERSION, 2);
+}
+
+gjstestRun();
diff --git a/test/js/test0030basicBoxed.js b/test/js/test0030basicBoxed.js
new file mode 100644
index 00000000..35ec43b1
--- /dev/null
+++ b/test/js/test0030basicBoxed.js
@@ -0,0 +1,8 @@
+var Regress = imports.gi.Regress;
+
+function testBasicBoxed() {
+ var a = new Regress.TestSimpleBoxedA();
+ a.some_int = 42;
+}
+
+gjstestRun();
diff --git a/test/js/test0040mainloop.js b/test/js/test0040mainloop.js
new file mode 100644
index 00000000..e1d3479c
--- /dev/null
+++ b/test/js/test0040mainloop.js
@@ -0,0 +1,15 @@
+var Mainloop = imports.mainloop;
+
+function testBasicMainloop() {
+ log('running mainloop test');
+ Mainloop.idle_add(function() { Mainloop.quit('testMainloop'); });
+ Mainloop.run('testMainloop');
+ log('mainloop test done');
+}
+
+/* A dangling mainloop idle should get removed and not leaked */
+function testDanglingIdle() {
+ Mainloop.idle_add(function() { return true; });
+}
+
+gjstestRun();