[gjs/wip/xulrunner-1.9.3-rebase5: 7/26] tests: Add two basic tests



commit 8babb00bf7382addd18b3d9d046aac045511a1e3
Author: Colin Walters <walters verbum org>
Date:   Mon Sep 20 13:32:59 2010 -0400

    tests: Add two 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.

 test/js/test0001basic.js      |    6 ++++++
 test/js/test0002importer.js   |    6 ++++++
 test/js/test0003basicBoxed.js |    8 ++++++++
 test/js/test0004mainloop.js   |   15 +++++++++++++++
 test/js/test0005basicDBus.js  |   11 +++++++++++
 5 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/test/js/test0001basic.js b/test/js/test0001basic.js
new file mode 100644
index 0000000..30bb07b
--- /dev/null
+++ b/test/js/test0001basic.js
@@ -0,0 +1,6 @@
+function testBasic1() {
+    var foo = 1+1;
+    log("1 + 1 = " + foo);
+}
+
+gjstestRun();
diff --git a/test/js/test0002importer.js b/test/js/test0002importer.js
new file mode 100644
index 0000000..69c223e
--- /dev/null
+++ b/test/js/test0002importer.js
@@ -0,0 +1,6 @@
+function testImporter1() {
+    var GLib = imports.gi.GLib;
+    log("GLib.E="+GLib.E);
+}
+
+gjstestRun();
diff --git a/test/js/test0003basicBoxed.js b/test/js/test0003basicBoxed.js
new file mode 100644
index 0000000..35ec43b
--- /dev/null
+++ b/test/js/test0003basicBoxed.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/test0004mainloop.js b/test/js/test0004mainloop.js
new file mode 100644
index 0000000..a0b0ea6
--- /dev/null
+++ b/test/js/test0004mainloop.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 timeout should get removed and not leaked */
+function testDanglingTimeout() {
+    Mainloop.timeout_add(5000, function() { log("this should not run"); });
+}
+
+gjstestRun();
diff --git a/test/js/test0005basicDBus.js b/test/js/test0005basicDBus.js
new file mode 100644
index 0000000..5fad21b
--- /dev/null
+++ b/test/js/test0005basicDBus.js
@@ -0,0 +1,11 @@
+var DBus = imports.dbus;
+var Mainloop = imports.mainloop;
+
+function testExportName() {
+    var exportedNameId = DBus.session.acquire_name('com.litl.Real', DBus.SINGLE_INSTANCE,
+						   function(name){log("Acquired name " + name); Mainloop.quit('dbus'); },
+						   function(name){log("Lost name  " + name);});
+    Mainloop.run('dbus');
+}
+
+gjstestRun();



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