tests: Ditch the python test framework, use standard make check with a small
authorTim Horton <hortont424@gmail.com>
Wed, 6 Jan 2010 08:47:37 +0000 (03:47 -0500)
committerTim Horton <hortont424@gmail.com>
Wed, 6 Jan 2010 08:47:37 +0000 (03:47 -0500)
set of JavaScript functions to deal with assertions and unreachable code
and whatnot. Also, clean up some tests, and remove some that made no sense
whatsoever.

Three or four tests still don't work (and print output to that effect)
because of strange exception-chaining problems which I'm going to look into.

82 files changed:
Makefile.am
tests/Makefile.am
tests/javascript/Makefile.am
tests/javascript/argv.js
tests/javascript/array-gtype.js
tests/javascript/builtin-argument-length.js
tests/javascript/c-module.js [deleted file]
tests/javascript/check-syntax.js
tests/javascript/closure-finalization.js
tests/javascript/compare.js
tests/javascript/constructor-args.js
tests/javascript/constructor-prototype.js
tests/javascript/enum.js
tests/javascript/everything.js
tests/javascript/fork.js
tests/javascript/function-info.js
tests/javascript/gdk-event.js
tests/javascript/gerror.js
tests/javascript/gobject-scope.js
tests/javascript/gtypes/Makefile.am
tests/javascript/gtypes/gtype-class-init-exception.js
tests/javascript/gtypes/gtype-extraprop.js
tests/javascript/gtypes/gtype-gtype-class-init.js
tests/javascript/gtypes/gtype-gtype.js
tests/javascript/gtypes/gtype-property-construct.js
tests/javascript/gtypes/gtype-property-nice.js
tests/javascript/gtypes/gtype-property.js
tests/javascript/gtypes/gtype-self.js
tests/javascript/gtypes/gtype-signal-args.js
tests/javascript/gtypes/gtype-signal.js
tests/javascript/gtypes/gtype-typerror.js
tests/javascript/gtypes/gtype.js
tests/javascript/gtypes/testsuite.js [new symlink]
tests/javascript/gvalue-argument.js
tests/javascript/include-syntax.js
tests/javascript/include.js
tests/javascript/introspect.js
tests/javascript/json-constructor.js
tests/javascript/json.js
tests/javascript/list-test.js
tests/javascript/modules-noasserts.js [new file with mode: 0755]
tests/javascript/modules.js
tests/javascript/native-closure-exception.js
tests/javascript/native-closure.js
tests/javascript/object-info.js
tests/javascript/out-test.js
tests/javascript/print.js [deleted file]
tests/javascript/printf.js [deleted file]
tests/javascript/printprint.js [deleted file]
tests/javascript/property-benchmark.js
tests/javascript/property-glib-exception.js
tests/javascript/quit.js
tests/javascript/quit2.js [deleted file]
tests/javascript/readline-bind.js [deleted file]
tests/javascript/readline.js [deleted file]
tests/javascript/signals/Makefile.am
tests/javascript/signals/signal-connect.js
tests/javascript/signals/signal-disconnect.js
tests/javascript/signals/signal-exception.js
tests/javascript/signals/signal-expects.js
tests/javascript/signals/signal-invalid.js
tests/javascript/signals/signal-nofunc.js
tests/javascript/signals/signal-userdata.js
tests/javascript/signals/signal.js
tests/javascript/signals/testsuite.js [new symlink]
tests/javascript/spawn.js [deleted file]
tests/javascript/sqlite.js
tests/javascript/structs/Makefile.am
tests/javascript/structs/struct-constructor.js
tests/javascript/structs/struct-enumerate.js
tests/javascript/structs/struct-functions.js
tests/javascript/structs/struct-nested-set.js
tests/javascript/structs/struct-offsets.js
tests/javascript/structs/struct-set-member.js
tests/javascript/structs/struct-union-enumerate.js
tests/javascript/structs/testsuite.js [new symlink]
tests/javascript/syntax-test-noasserts.js [new file with mode: 0755]
tests/javascript/syntax-test.js
tests/javascript/testsuite.js [new file with mode: 0755]
tests/javascript/type-conversion.js
tests/make-test.py [deleted file]
tests/run-tests.py [deleted file]

index 9387ef6..5bfb716 100644 (file)
@@ -28,13 +28,10 @@ EXTRA_DIST = $(seeddoc_DATA) \
 
 DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
 
-test:
-       cd tests ; ./run-tests.py
-
 profile-reset:
        find -name '*.gcda' -delete
 
-profile: profile-reset test
+profile: profile-reset check
        cp libseed/*.c libseed/.libs/
 
 if PROFILE_MODULES
index d88733d..a16435e 100644 (file)
@@ -1,8 +1,3 @@
 SUBDIRS = javascript c
-EXTRA_DIST = \
-    COPYING \
-    run-tests.py \
-    make-test.py
-
-## File created by the gnome-build tools
+EXTRA_DIST = COPYING
 
index 911d35e..c718637 100644 (file)
@@ -7,7 +7,6 @@ EXTRA_DIST = \
     builtin-argument-length.js \
     check-syntax.js \
     closure-finalization.js \
-    c-module.js \
     compare.js \
     constructor-args.js \
     constructor-prototype.js \
@@ -26,24 +25,52 @@ EXTRA_DIST = \
     json.js \
     list-test.js \
     modules.js \
+    modules-noasserts.js \
     native-closure-exception.js \
     native-closure.js \
     object-info.js \
     out-test.js \
-    printf.js \
-    print.js \
-    printprint.js \
     property-benchmark.js \
     property-glib-exception.js \
-    quit2.js \
     quit.js \
-    readline-bind.js \
-    readline.js \
-    spawn.js \
     sqlite.js \
     syntax-test.js \
-    type-conversion.js
-
+    syntax-test-noasserts.js \
+    type-conversion.js \
+    testsuite.js
 
-## File created by the gnome-build tools
+TESTS = \
+    argv.js \
+    array-gtype.js \
+    builtin-argument-length.js \
+    check-syntax.js \
+    closure-finalization.js \
+    compare.js \
+    constructor-args.js \
+    constructor-prototype.js \
+    enum.js \
+    everything.js \
+    fork.js \
+    function-info.js \
+    gdk-event.js \
+    gerror.js \
+    gobject-scope.js \
+    gvalue-argument.js \
+    include.js \
+    include-syntax.js \
+    introspect.js \
+    json-constructor.js \
+    json.js \
+    list-test.js \
+    modules.js \
+    native-closure-exception.js \
+    native-closure.js \
+    object-info.js \
+    out-test.js \
+    property-benchmark.js \
+    property-glib-exception.js \
+    quit.js \
+    sqlite.js \
+    syntax-test.js \
+    type-conversion.js
 
index 4e49cbc..67c6930 100755 (executable)
@@ -1,7 +1,3 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:seed
-// STDERR:
 
-print(Seed.argv[0]);
+imports.testsuite.assert(Seed.argv[0] == "seed")
index db50b1f..969f711 100755 (executable)
@@ -1,13 +1,17 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
 
 Gtk = imports.gi.Gtk;
 GObject = imports.gi.GObject;
 
 Gtk.init(Seed.argv);
 
-list = new Gtk.ListStore();
-list.set_column_types(2, [GObject.TYPE_STRING, GObject.TYPE_INT]);
+try
+{
+    list = new Gtk.ListStore();
+    list.set_column_types(2, [GObject.TYPE_STRING, GObject.TYPE_INT]);
+}
+catch(e)
+{
+    print(e)
+    imports.testsuite.unreachable()
+}
index e7b6769..ac6118a 100755 (executable)
@@ -1,61 +1,52 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Seed\.spawn expected 1 argument\nFailed to execute child process "asihfieuhgieuhgw" \(No such file or directory\)\nSeed\.include expected 1 argument, got 0\nFile not found: 1\nFile not found: \nSeed\.include expected 1 argument, got 2\nSeed\.include expected 1 argument, got 2\nprint expected 1 argument, got 0\nprint expected 1 argument, got 2\nprint expected 1 argument, got 2\nprint expected 1 argument, got 3\nSeed\.introspect expected 1 argument, got 0\nSeed\.introspect expected 1 argument, got 2\nSeed\.check_syntax expected 1 argument, got 0\nSeed\.check_syntax expected 1 argument, got 2
-// STDERR:
-
-try{
-Seed.spawn();
-}catch(e){print(e.message);}
-try{
-Seed.spawn("asihfieuhgieuhgw");
-}catch(e){print(e.message);}
-
-try{
-Seed.include();
-}catch(e){print(e.message);}
-try{
-Seed.include(1);
-}catch(e){print(e.message);}
-try{
-Seed.include("");
-}catch(e){print(e.message);}
-try{
-Seed.include(1,2);
-}catch(e){print(e.message);}
-try{
-Seed.include("fail.js","another.js");
-}catch(e){print(e.message);}
-
-try{
-print();
-}catch(e){print(e.message);}
-try{
-print(1, 2);
-}catch(e){print(e.message);}
-try{
-print("asdf", 2);
-}catch(e){print(e.message);}
-try{
-print(1, 2, 3);
-}catch(e){print(e.message);}
-
-try{
-Seed.introspect();
-}catch(e){print(e.message);}
-try{
-Seed.introspect(Seed, 5.23);
-}catch(e){print(e.message);}
-
-try{
-Seed.check_syntax();
-}catch(e){print(e.message);}
-try{
-Seed.check_syntax("5+5", "asdf");
-}catch(e){print(e.message);}
-
-try{
-Seed.quit(1,2);
-}catch(e){print(e.message);}
-
-Seed.quit();
+
+testsuite = imports.testsuite
+
+function correctArgs(fs, a)
+{
+    try
+    {
+        eval(fs).apply(this, a)
+    }
+    catch(e)
+    {
+        if(e.name == "ArgumentError")
+            testsuite.unreachable(fs)
+    }
+}
+
+function wrongArgs(fs, a)
+{
+    try
+    {
+        eval(fs).apply(this, a)
+        testsuite.unreachable(fs)
+    }
+    catch(e)
+    {
+        
+    }
+}
+
+wrongArgs("Seed.spawn", [])
+correctArgs("Seed.spawn", ["asdfasdfasdf"])
+
+wrongArgs("Seed.include", [])
+wrongArgs("Seed.include", [1])
+correctArgs("Seed.include", [""])
+wrongArgs("Seed.include", [1,2])
+wrongArgs("Seed.include", ["fail.js","another.js"])
+
+wrongArgs("print", [])
+wrongArgs("print", [1,2])
+wrongArgs("print", ["asdf",2])
+wrongArgs("print", [1,2,3])
+
+wrongArgs("Seed.introspect", [])
+correctArgs("Seed.introspect", [Seed])
+wrongArgs("Seed.introspect", [Seed, 5.23])
+
+wrongArgs("Seed.check_syntax", [])
+correctArgs("Seed.check_syntax", ["asdfasdf"])
+wrongArgs("Seed.check_syntax", ["5+5", "asdf"])
+
diff --git a/tests/javascript/c-module.js b/tests/javascript/c-module.js
deleted file mode 100755 (executable)
index a022784..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello Seed Module World
-// STDERR:
-
-example = imports.example;
index fc3b0ed..007c8ae 100755 (executable)
@@ -1,12 +1,32 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:ONE\n\[null\]\nTWO\n\[null\]\nTHREE
-// STDERR:\n\*\* \(seed:[0-9]+\): CRITICAL \*\*: Line 1 in \[undefined\]: SyntaxError Parse error
-
-print("ONE");
-print(Seed.check_syntax("5+5;"));
-print("TWO");
-print(Seed.check_syntax("asdfasdf.jsdf()"));
-print("THREE");
-print(Seed.check_syntax("one[)"));
+
+testsuite = imports.testsuite
+
+try
+{
+    Seed.check_syntax("5+5;")
+}
+catch(e)
+{
+    testsuite.unreachable("5+5; is not a syntax error")
+}
+
+try
+{
+    Seed.check_syntax("asdfasdf.jsdf()")
+}
+catch(e)
+{
+    testsuite.unreachable("asdfasdf.jsdf() is not a syntax error")
+}
+
+try
+{
+    Seed.check_syntax("one[)")
+    testsuite.unreachable("one[) should be a syntax error")
+}
+catch(e)
+{
+    testsuite.assert(e instanceof SyntaxError)
+}
+
index 66f3123..003946e 100755 (executable)
@@ -1,9 +1,6 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[object GtkVBox\]
-// STDERR:
 
+testsuite = imports.testsuite;
 Gtk = imports.gi.Gtk;
 
 Gtk.init(Seed.argv);
@@ -13,7 +10,10 @@ w = new Gtk.Window();
 // Closure will always be GCed at end of signal.
 signal = function()
 {
-       w.foreach(function(widget){print(widget);});
+    widgets = []
+       w.foreach(function(widget){widgets.push(widget.toString())})
+       testsuite.assert(widgets[0] == ["[object GtkVBox]"])
+       testsuite.assert(widgets.length == 1)
 };
 
 vbox = new Gtk.VBox();
@@ -23,3 +23,5 @@ w.add(vbox);
 w.signal.show.connect(signal);
 
 w.show_all();
+
+testsuite.checkAsserts(2)
index e04f850..6a4f59c 100755 (executable)
@@ -1,15 +1,13 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:0\n1
-// STDERR:
 
+testsuite = imports.testsuite
 Gtk = imports.gi.Gtk;
+
 Gtk.init(Seed.argv);
 
 var a = new Gtk.Button();
 var b = new Gtk.Button();
 var c = a;
 
-print(a == b);
-print(c == a);
+testsuite.assert(a != b);
+testsuite.assert(c == a);
index ac57e38..efdfa94 100755 (executable)
@@ -1,9 +1,6 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Constructor expects 1 argument, got 2\nConstructor expects object as argument
-// STDERR:
 
+testsuite = imports.testsuite
 Gtk = imports.gi.Gtk;
 Gtk.init(Seed.argv);
 
@@ -13,23 +10,27 @@ try
 }
 catch (e)
 {
-       print(e.message);
+       testsuite.unreachable()
 }
 
 try
 {
        w = new Gtk.Window(1, 2);
+       testsuite.unreachable()
 }
 catch (e)
 {
-       print(e.message);
+       testsuite.assert(e.name == "ArgumentError") 
 }
 
 try
 {
        w = new Gtk.Window("safA");
+       testsuite.unreachable()
 }
 catch (e)
 {
-       print(e.message);
+       testsuite.assert(e.name == "ArgumentError")
 }
+
+testsuite.checkAsserts(2)
index cc7601d..d45c193 100755 (executable)
@@ -1,13 +1,12 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello World
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
-Gtk.Window.prototype.hello = "Hello World";
+Gtk.init(Seed.argv)
 
-a = new Gtk.Window();
-print(a.hello);
+Gtk.Window.prototype.hello = "Hello World"
+
+a = new Gtk.Window()
+
+testsuite.assert(a.hello == "Hello World")
index 8488d51..b68a5a6 100755 (executable)
@@ -1,15 +1,13 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:2
-// STDERR:
 
+testsuite = imports.testsuite
 Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
 
-b = new Gtk.Button();
-b.relief = Gtk.ReliefStyle.NONE;
+Gtk.init(Seed.argv);
 
-print(Gtk.ReliefStyle.NONE);
+b = new Gtk.Button()
+b.relief = Gtk.ReliefStyle.NONE
 
+testsuite.assert(Gtk.ReliefStyle.NONE == 2)
+testsuite.assert(b.relief == 2)
 
index ec54bdd..8a61b8f 100755 (executable)
@@ -1,70 +1,71 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:1\n-124\n129\n-1235\n1387\n-123435\n133487\n-16323375\n13873737\n-16325\n33737\n-16325\n33737\n12\n143\n-1853\.12329101562\n-134543853\.12334\n8\n\["åäö","\/etc\/fstab"\]\n\["1","2","3"\]\n\["1","2","3"\]\n\["1","2","3"\]\n\["1","2","3"\]\nthanks,for,all,the,fish\n5\n0\n123\n0\n1\n42\n1\n2\n4\n15\n120\n120\.2357\n42\n19
-// STDERR:
 
-Everything = imports.gi.Everything;
-GObject = imports.gi.GObject;
+testsuite = imports.testsuite
+Everything = imports.gi.Everything
+GObject = imports.gi.GObject
+JSON = imports.JSON
 
-JSON = imports.JSON;
+assert = testsuite.assert
 
 with(Everything)
 {
-print(test_boolean(true));
-print(test_int8(-124));
-print(test_uint8(129));
-print(test_int16(-1235));
-print(test_uint16(1387));
-print(test_int32(-123435));
-print(test_uint32(133487));
-print(test_int64(-16323375));
-print(test_uint64(13873737));
-print(test_int(-16325));
-print(test_uint(33737));
-print(test_long(-16325));
-print(test_ulong(33737));
-print(test_ssize(12));
-print(test_size(143));
-print(test_float(-1853.12334));
-print(test_double(-134543853.12334));
-//Need support for: print(test_timet(1853));
-print(test_gtype(8));
+assert(test_boolean(true) == true)
+assert(test_int8(-124) == -124)
+assert(test_uint8(129) == 129)
+assert(test_int16(-1235) == -1235)
+assert(test_uint16(1387) == 1387)
+assert(test_int32(-123435) == -123435)
+assert(test_uint32(133487) == 133487)
+assert(test_int64(-16323375) == -16323375)
+assert(test_uint64(13873737) == 13873737)
+assert(test_int(-16325) == -16325)
+assert(test_uint(33737) == 33737)
+assert(test_long(-16325) == -16325)
+assert(test_ulong(33737) == 33737)
+assert(test_ssize(12) == 12)
+assert(test_size(143) == 143)
+assert(test_float(-1853.12334) > (-1853.12334 - 0.001))
+assert(test_float(-1853.12334) < (-1853.12334 + 0.001))
+assert(test_double(-134543853.12334) > (-134543853.12334 - 0.001))
+assert(test_double(-134543853.12334) < (-134543853.12334 + 0.001))
+//assert(test_timet(1853) == 1853)
+assert(test_gtype(8) == 8)
 
-print(JSON.stringify(test_filename_return()));
-print(JSON.stringify(test_glist_nothing_return()));
-print(JSON.stringify(test_glist_nothing_return2()));
-print(JSON.stringify(test_glist_container_return()));
-print(JSON.stringify(test_glist_everything_return()));
+assert(test_filename_return()[0] == "åäö")
+assert(test_filename_return()[1] == "/etc/fstab")
+assert(test_glist_nothing_return()[0] == "1")
+assert(test_glist_nothing_return2()[1] == "2")
+assert(test_glist_container_return()[2] == "3")
+assert(test_glist_everything_return()[1] == "2")
 
-//test_glist_nothing_in([2, 3, 4]);
+//test_glist_nothing_in([2, 3, 4])
 
-print(test_strv_out());
+assert(test_strv_out().toString() == "thanks,for,all,the,fish")
 
-// These are broken... Robb's working on them:
-print(test_closure(function () { return [GObject.TYPE_INT, 5]; }));
-print(test_closure_one_arg(function (a) { return [GObject.TYPE_INT, a]; }));
+assert(test_closure(function () { return [GObject.TYPE_INT, 5] }) == 5)
+assert(test_closure_one_arg(function (a) { return [GObject.TYPE_INT, a] }) == 0)
 
-print(test_value_return(123).get_int());
+assert(test_value_return(123).get_int() == 123)
 
-print(TestEnum.VALUE1);
-print(TestEnum.VALUE2);
-print(TestEnum.VALUE3);
-print(TestFlags.FLAG1);
-print(TestFlags.FLAG2);
-print(TestFlags.FLAG3);
+assert(TestEnum.VALUE1 == 0)
+assert(TestEnum.VALUE2 == 1)
+assert(TestEnum.VALUE3 == 42)
+assert(TestFlags.FLAG1 == 1)
+assert(TestFlags.FLAG2 == 2)
+assert(TestFlags.FLAG3 == 4)
 
-TestStructA.some_int = 15;
-print(TestStructA.some_int);
-TestStructA.some_int8 = 120;
-print(TestStructA.some_int8);
-TestStructA.some_double = 120.2357;
-print(TestStructA.some_double);
-TestStructA.some_enum = TestEnum.VALUE3;
-print(TestStructA.some_enum);
+TestStructA.some_int = 15
+assert(TestStructA.some_int == 15)
+TestStructA.some_int8 = 120
+assert(TestStructA.some_int8 == 120)
+TestStructA.some_double = 120.2357
+assert(TestStructA.some_double > (120.2357 - 0.001))
+assert(TestStructA.some_double < (120.2357 + 0.001))
+TestStructA.some_enum = TestEnum.VALUE3
+assert(TestStructA.some_enum == 42)
 
-TestStructB.some_int8 = 19;
-print(TestStructB.some_int8);
-//TestStructB.nested_a.some_double = 134.3455;
-//print(TestStructB.nested_a.some_double);
+TestStructB.some_int8 = 19
+assert(TestStructB.some_int8 == 19)
+//TestStructB.nested_a.some_double = 134.3455
+//print(TestStructB.nested_a.some_double)
 }
index bfefa24..ad87572 100755 (executable)
@@ -1,16 +1,8 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:[AB]\n[AB]
-// STDERR:
-os = imports.os;
-var a = os.fork();
 
-if(a)
-{
-       print("A");
-}
-else
-{
-       print("B");
-}
+testsuite = imports.testsuite
+os = imports.os
+
+a = os.fork()
+
+testsuite.assert(a >= 0)
index 07873cf..60c6a43 100755 (executable)
@@ -1,12 +1,9 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:resize
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-GIRepository = imports.gi.GIRepository;
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+GIRepository = imports.gi.GIRepository
 
-f = Gtk.Window.prototype.resize.info;
+f = Gtk.Window.prototype.resize.info
 
-print(GIRepository.base_info_get_name(f));
+testsuite.assert(GIRepository.base_info_get_name(f) == "resize")
index d88e19c..e71c4ed 100755 (executable)
@@ -1,28 +1,27 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[object GdkWindow\]\n\[object GdkWindow\]\n1\n200
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gdk = imports.gi.Gdk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gdk = imports.gi.Gdk
+Gtk.init(Seed.argv)
 
 function paint(wdg, evt)
 {
-       print(evt.expose.window);
-       print(wdg.window);
-       print(evt.expose.window === wdg.window);
+    testsuite.assert(evt.expose.window instanceof Gdk.Window)
+    testsuite.assert(wdg.window instanceof Gdk.Window)
+    testsuite.assert(evt.expose.window == wdg.window)
+    testsuite.assert(evt.expose.area.width == 200)
 
-       print(evt.expose.area.width);
+       Gtk.main_quit()
 
-       Gtk.main_quit();
-       return false;
+       return false
 }
 
-var win = new Gtk.Window();
-win.signal.expose_event.connect(paint);
-win.resize(200,200);
-win.show();
+var win = new Gtk.Window()
+win.signal.expose_event.connect(paint)
+win.resize(200,200)
+win.show()
 
-Gtk.main();
+Gtk.main()
+
+testsuite.checkAsserts(4)
index 907e6e1..20690c0 100755 (executable)
@@ -1,16 +1,14 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:GIoError Error opening file .* Is a directory
-// STDERR:
 
-Gio = imports.gi.Gio;
+testsuite = imports.testsuite
+Gio = imports.gi.Gio
 
 try
 {
-       Gio.simple_write(".", "test");
+       Gio.simple_write(".", "test")
+       testsuite.unreachable()
 }
 catch (e)
 {
-       print(e.name+" "+e.message);
+       testsuite.assert(e.name == "GIoError")
 }
index 5b71910..a510049 100755 (executable)
@@ -1,15 +1,13 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
 
-Gtk = imports.gi.Gtk;
+// TODO: this test doesn't actually test anything...
 
-Gtk.init(Seed.argv);
+Gtk = imports.gi.Gtk
+
+Gtk.init(Seed.argv)
 
 for(var i = 0; i < 100; i++)
 {
-    var button = new Gtk.Button({label: "Test!"});
+    var button = new Gtk.Button({label: "Test!"})
 }
 
index 7347f94..f7d9edf 100644 (file)
@@ -1,4 +1,19 @@
 EXTRA_DIST = \
+       gtype-class-init-exception.js \
+       gtype-property.js \
+       gtype-typerror.js \
+       gtype.js \
+       gtype-gtype.js \
+       gtype-signal-args.js \
+       gtype-property-construct.js \
+       gtype-property-nice.js \
+       gtype-self.js \
+       gtype-extraprop.js \
+       gtype-gtype-class-init.js \
+       gtype-signal.js \
+       testsuite.js
+
+TESTS = \
        gtype-class-init-exception.js \
        gtype-property.js \
        gtype-typerror.js \
index 2a10ad2..e537c6e 100755 (executable)
@@ -4,20 +4,34 @@
 // STDOUT:
 // STDERR:\n\*\* \(seed:[0-9]+\): WARNING \*\*: Exception in class init closure\. Line 14 in .*\/gtype-class-init-exception\.js: ReferenceError Can't find variable: notAVariable
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
 HelloWindowType = {
     parent: Gtk.Window.type,
     name: "HelloWindow",
     class_init: function(klass, prototype)
     {
-               prototype = notAVariable.notAProperty;
+               prototype = notAVariable.notAProperty
     },
     init: function(klass)
     {
-    }};
+    }
+}
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
+try
+{
+    HelloWindow = new GType(HelloWindowType)
+    w = new HelloWindow()
+}
+catch(e)
+{
+    testsuite.assert(e instanceof ReferenceError)
+    // TODO: THIS TEST DOESN'T WORK EITHER!
+    // what's going on with chained exception stuff
+}
 
+//testsuite.checkAsserts(1)
+
+print("This test doesn't work yet...")
index c348588..5ecd17a 100755 (executable)
@@ -1,21 +1,20 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:1
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
-HelloWindowType = {
+Gtk.init(Seed.argv)
+
+HelloWindow = new GType({
     parent: Gtk.Window.type,
     name: "HelloWindow",
-    init: function(self){
-       print(self.test);
-    }};
-
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow({test: 1});
+    init: function(self)
+    {
+           testsuite.assert(self.test == 2)
+           testsuite.assert(self.testAgain == "arst")
+    }
+})
 
-w.show();
+w = new HelloWindow({test: 2, testAgain: "arst"})
 
+testsuite.checkAsserts(2)
index 8740bb2..0523e0b 100755 (executable)
@@ -1,30 +1,30 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Class init
-// STDERR:
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
 
-HelloWindowType = {
- parent: Gtk.Window.type,
- name: "HelloWindow",
- init: function(){
-  }
-};
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
+HelloWindow = new GType({
+    parent: Gtk.Window.type,
+    name: "HelloWindow",
+    init: function()
+    {
+    }
+})
 
-InheritedWindowType = {
- parent: HelloWindow.type,
- name: "InheritedWindow",
- class_init: function(klass, prototype) {print("Class init")},
- init: function(){
-  }
-};
+w = new HelloWindow()
 
-InheritedWindow = new GType(InheritedWindowType);
-
-b = new InheritedWindow();
+InheritedWindow = new GType({
+    parent: HelloWindow.type,
+    name: "InheritedWindow",
+    class_init: function(klass, prototype)
+    {
+        testsuite.assert(1)
+    },
+    init: function()
+    {
+    }
+})
 
+b = new InheritedWindow()
+testsuite.checkAsserts(1)
index 88d8a00..3bbe418 100755 (executable)
@@ -1,31 +1,29 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hi\nHi\nbye
-// STDERR:
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
 
-HelloWindowType = {
- parent: Gtk.Window.type,
- name: "HelloWindow",
- init: function(){
-    print("Hi");
-  }
-};
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
+HelloWindow = new GType({
+    parent: Gtk.Window.type,
+    name: "HelloWindow",
+    init: function(self)
+    {
+        self.id = 5
+    }
+})
 
-InheritedWindowType = {
- parent: HelloWindow.type,
- name: "InheritedWindow",
- init: function(){
-    print("bye");
-  }
-};
+InheritedWindow = new GType({
+    parent: HelloWindow.type,
+    name: "InheritedWindow",
+    init: function(self)
+    {
+        self.id = 10
+    }
+})
 
-InheritedWindow = new GType(InheritedWindowType);
-
-b = new InheritedWindow();
+w = new HelloWindow()
+b = new InheritedWindow()
 
+testsuite.assert(w.id == 5)
+testsuite.assert(b.id == 10)
index c93f446..daa828b 100755 (executable)
@@ -1,30 +1,41 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:1
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-GObject = imports.gi.GObject;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+GObject = imports.gi.GObject
+Gtk.init(Seed.argv)
 
-HelloWindowType = {
-parent: Gtk.Window.type,
-name: "HelloWindow",
-class_init: function(klass, prototype)
-{
-       klass.c_install_property(GObject.param_spec_boolean("test",
-                                                                                                         "test property",
-                                                                                                         "A test property!",
-                                                                                                         false,
-                                                                                                         GObject.ParamFlags.CONSTRUCT | GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE));
-},
-init: function()
-{
-  print(this.test);
-}};
+HelloWindow = new GType({
+    parent: Gtk.Window.type,
+    name: "HelloWindow",
+    class_init: function(klass, prototype)
+    {
+        klass.c_install_property(GObject.param_spec_boolean(
+                                 "test",
+                                 "test property",
+                                 "A test property!",
+                                 false,
+                                 GObject.ParamFlags.CONSTRUCT | 
+                                     GObject.ParamFlags.READABLE | 
+                                     GObject.ParamFlags.WRITABLE))
+    },
+    init: function()
+    {
+        testsuite.assert(this.test == true)
+    }
+})
+
+w = new HelloWindow({test: true})
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow({test: true});
+testsuite.assert(w.test == true)
 
+try
+{
+    w.test = "arst"
+}
+catch(e)
+{
+    testsuite.assert(e.name == "ConversionError")
+}
 
+testsuite.checkAsserts(3)
index d8958a8..ed0613d 100755 (executable)
@@ -1,32 +1,30 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:1\n1\n0
-// STDERR:
 
-GObject = imports.gi.GObject;
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+GObject = imports.gi.GObject
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-HelloWindowType = {
+HelloWindow = new GType({
     parent: Gtk.Window.type,
     name: "HelloWindow",
-    properties: [{name: "randomproperty",
-                 type: GObject.TYPE_BOOLEAN,
-                 nick: "randomproperty",
-                 blurb: "longer blurb about property",
-                 default_value: true,
-                 flags: (GObject.ParamFlags.CONSTRUCT | GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE)}],
+    properties: [{
+        name: "randomproperty",
+        type: GObject.TYPE_BOOLEAN,
+        nick: "randomproperty",
+        blurb: "longer blurb about property",
+        default_value: true,
+        flags: (GObject.ParamFlags.CONSTRUCT | GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE)}],
     init: function(klass)
     {
 
-    }};
+    }
+})
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
+w = new HelloWindow()
 
-print(w.randomproperty);
-w.randomproperty = 5;
-print(w.randomproperty);
-w.randomproperty = 0;
-print(w.randomproperty);
+testsuite.assert(w.randomproperty == 1)
+w.randomproperty = 5
+testsuite.assert(w.randomproperty == 1)
+w.randomproperty = 0
+testsuite.assert(w.randomproperty == 0)
index e8ba56e..f30e46d 100755 (executable)
@@ -1,31 +1,30 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:1\n0
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-GObject = imports.gi.GObject;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+GObject = imports.gi.GObject
+Gtk.init(Seed.argv)
 
-HelloWindowType = {
-parent: Gtk.Window.type,
-name: "HelloWindow",
-class_init: function(klass, prototype)
-{
-       klass.c_install_property(GObject.param_spec_boolean("test",
-                                                                                                         "test property",
-                                                                                                         "A test property!",
-                                                                                                         false,
-                                                                                                         GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE));
-},
-init: function()
-{
-}};
+HelloWindow = new GType({
+    parent: Gtk.Window.type,
+    name: "HelloWindow",
+    class_init: function(klass, prototype)
+    {
+        klass.c_install_property(GObject.param_spec_boolean(
+            "test",
+            "test property",
+            "A test property!",
+            false,
+            GObject.ParamFlags.READABLE | 
+                GObject.ParamFlags.WRITABLE))
+    },
+    init: function()
+    {
+    }
+})
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow({test: true});
-print(w.test);
-w = new HelloWindow();
-print(w.test);
+w = new HelloWindow({test: true})
+testsuite.assert(w.test == true)
+w = new HelloWindow()
+testsuite.assert(w.test == false)
 
index 542e8a3..256a7ae 100755 (executable)
@@ -1,21 +1,18 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:1
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-HelloWindowType = {
+HelloWindow = new GType({
     parent: Gtk.Window.type,
     name: "HelloWindow",
-    init: function(self){
-       print(this==self);
-    }};
+    init: function(self)
+    {
+           testsuite.assert(this == self)
+    }
+})
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
-
-w.show();
+w = new HelloWindow()
 
+testsuite.checkAsserts(1)
index 872ffd4..02853a5 100755 (executable)
@@ -1,29 +1,29 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:2 Test\n\[object GtkWindow\]
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-GObject = imports.gi.GObject;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+GObject = imports.gi.GObject
+Gtk.init(Seed.argv)
 
 HelloWindow = new GType({
     parent: Gtk.Window.type,
     name: "HelloWindow",
     signals: [{name: "hello",
-              parameters: [GObject.TYPE_INT,
-                           GObject.TYPE_STRING],
-              return_type: Gtk.Window.type}]
-});
+               parameters: [GObject.TYPE_INT,
+                            GObject.TYPE_STRING],
+               return_type: Gtk.Window.type}]
+})
 
-w = new HelloWindow();
+w = new HelloWindow()
 
 w.signal.hello.connect(function(object, number, string)
-                       {
-                           var win = new Gtk.Window();
-                           print(number + " " + string);
-                           return win;
-                       });
-print(w.signal.hello.emit(2, "Test"));
+{
+   var win = new Gtk.Window()
+   testsuite.assert(number == 2)
+   testsuite.assert(string == "Test")
+   return win
+})
 
+testsuite.assert(w.signal.hello.emit(2, "Test") instanceof Gtk.Window)
+
+testsuite.checkAsserts(3)
index 1fbb949..1705f10 100755 (executable)
@@ -1,24 +1,23 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello\nGoodbye
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
 HelloWindowType = {
     parent: Gtk.Window.type,
     name: "HelloWindow",
     signals: [{name: "hello"}, {name: "goodbye"}]
-};
+}
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
+HelloWindow = new GType(HelloWindowType)
+w = new HelloWindow()
 
-w.signal.hello.connect(function(){print("Hello");});
-w.signal.goodbye.connect(function(){print("Goodbye");});
+w.signal.hello.connect(function(){hello = 5})
+w.signal.goodbye.connect(function(){goodbye = 10})
 
-w.signal.hello.emit();
-w.signal.goodbye.emit();
+w.signal.hello.emit()
+w.signal.goodbye.emit()
 
+testsuite.assert(hello == 5)
+testsuite.assert(goodbye == 10)
index 3af6191..27ec47a 100755 (executable)
@@ -1,17 +1,18 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:GType constructor expected GType for parent
-// STDERR:
-
-Gtk = imports.gi.Gtk;
 
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
 HelloWindowType = {
     parent: "Mom",
     name: "HelloWindow"
-};
+}
 
-try{
-    HelloWindow = new GType(HelloWindowType);
-} catch (e) {print(e.message);}
+try
+{
+    HelloWindow = new GType(HelloWindowType)
+}
+catch (e)
+{
+    testsuite.assert(e.message == "GType constructor expected GType for parent")
+}
index 71b8103..9a3af7b 100755 (executable)
@@ -1,33 +1,33 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:In klass init\nIn constructor for \[object HelloWindow\]\nPrototypes!\nIn map, verifying widget\.title : Hello!
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
-HelloWindowType = {
+Gtk.init(Seed.argv)
+
+HelloWindow = new GType({
     parent: Gtk.Window.type,
     name: "HelloWindow",
     class_init: function(klass, prototype)
     {
-        prototype.message = "Prototypes!";
-        print("In klass init");
+        prototype.message = "Prototypes!"
     },
-    init: function(klass)
+    init: function(self)
     {
-        this.title = "Hello!";
-        print("In constructor for " + this);
-    }};
+        this.title = "Hello!"
+    }
+})
+
+w = new HelloWindow()
+
+testsuite.assert(w.message = "Prototypes!")
 
-HelloWindow = new GType(HelloWindowType);
-w = new HelloWindow();
-print(w.message);
 w.signal.map.connect(
-             function(widget)
-             {
-                 print("In map, verifying widget.title : " + widget.title);
-             });
-w.show();
+    function(widget)
+    {
+        testsuite.assert(widget.title == "Hello!")
+    })
+
+w.show()
 
+testsuite.checkAsserts(2)
diff --git a/tests/javascript/gtypes/testsuite.js b/tests/javascript/gtypes/testsuite.js
new file mode 120000 (symlink)
index 0000000..78d069d
--- /dev/null
@@ -0,0 +1 @@
+../testsuite.js
\ No newline at end of file
index 0d0112b..b3a6462 100755 (executable)
@@ -1,8 +1,4 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
 
 Gtk = imports.gi.Gtk;
 GObject = imports.gi.GObject
index fc935d8..950d0c6 100755 (executable)
@@ -1,7 +1,16 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:\n\*\* \(seed:[0-9]+\): CRITICAL \*\*: Line 6 in syntax-test\.js: SyntaxError Parse error
 
-Seed.include("syntax-test.js");
+testsuite = imports.testsuite
+
+try
+{
+    Seed.include("syntax-test-noasserts.js")
+    testsuite.unreachable()
+}
+catch(e)
+{
+    testsuite.assert(e instanceof SyntaxError)
+}
+
+testsuite.checkAsserts(1)
+
index 1c3285f..ccc71de 100755 (executable)
@@ -1,7 +1,3 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello, world!
-// STDERR:
 
-Seed.include("print.js");
+Seed.include("json.js");
index ddac59a..b02f991 100755 (executable)
@@ -1,12 +1,15 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\{"name":"set_opacity","return_type":"void","args":\{"0":\{"type":"double"\}\}\}
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-JSON = imports.JSON;
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+JSON = imports.JSON
 
-Gtk.init(Seed.argv);
-win = new Gtk.Window();
-print(JSON.stringify(Seed.introspect(win.set_opacity)));
+Gtk.init(Seed.argv)
+
+win = new Gtk.Window()
+
+info = Seed.introspect(win.set_opacity)
+
+testsuite.assert(info.name == "set_opacity")
+testsuite.assert(info.return_type == "void")
+testsuite.assert(info.args[0].type == "double")
index 2acfce9..2c2a262 100755 (executable)
@@ -1,15 +1,12 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:JSON Win!
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-GLib = imports.gi.GLib;
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+GLib = imports.gi.GLib
 
-Gtk.init(Seed.argv);
-window = new Gtk.Window({title: "JSON Win!"});
-window.show_all();
+Gtk.init(Seed.argv)
 
-print(window.title);
+window = new Gtk.Window({title: "JSON Win!"})
+window.show_all()
 
+testsuite.assert(window.title == "JSON Win!")
index db1d09a..2035046 100755 (executable)
@@ -1,16 +1,20 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
+
+testsuite = imports.testsuite;
 JSON = imports.JSON;
 
 a = {test: 3,
      hello: "Goodbye",
-     more: {a: "1", b: 2, c:"d"}};
-json = JSON.stringify(a);
-object = JSON.parse(json);
-json2 = JSON.stringify(object);
-if (json != json2)
-    print("Failure");
+     more: {a: "1", b: 2, c:"d"}}
+
+json = JSON.stringify(a)
+object = JSON.parse(json)
+json2 = JSON.stringify(object)
+
+testsuite.assert(json == json2)
+testsuite.assert(object.test == 3)
+testsuite.assert(object.hello == "Goodbye")
+testsuite.assert(object.more.a == "1")
+testsuite.assert(object.more.b == 2)
+testsuite.assert(object.more.c == "d")
 
index 8a9948d..bfc1505 100755 (executable)
@@ -1,20 +1,20 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[object GtkButton\],\[object GtkButton\]\n\[object GtkButton\]\n\[object GtkButton\]
-// STDERR:
 
-Gtk = imports.gi.Gtk;
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
-Gtk.init(Seed.argv);
+Gtk.init(Seed.argv)
 
-b1 = new Gtk.Button();
-b2 = new Gtk.Button();
-vbox = new Gtk.VBox();
-vbox.pack_start(b1);
-vbox.pack_start(b2);
+b1 = new Gtk.Button()
+b2 = new Gtk.Button()
+vbox = new Gtk.VBox()
+vbox.pack_start(b1)
+vbox.pack_start(b2)
+
+children = vbox.get_children()
+
+testsuite.assert(children[0] instanceof Gtk.Button)
+testsuite.assert(children[1] instanceof Gtk.Button)
+testsuite.assert(children[0] != children[1])
+testsuite.assert(children.length == 2)
 
-children = vbox.get_children();
-print(children);
-print(children[0]);
-print(children[1]);
diff --git a/tests/javascript/modules-noasserts.js b/tests/javascript/modules-noasserts.js
new file mode 100755 (executable)
index 0000000..e421322
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env seed
+
+// This test is merely to appease the coverage checker (calls init in each
+// module); it will also catch unresolved symbol errors in the modules.
+
+try
+{
+       cairo = imports.cairo;
+       canvas = imports.canvas;
+       dbus = imports.dbus;
+       example = imports.example;
+       gettext = imports.gettext;
+       gtkbuilder = imports.gtkbuilder;
+       libxml = imports.libxml;
+       mpfr = imports.mpfr;
+       Multiprocessing = imports.Multiprocessing;
+       os = imports.os;
+       readline = imports.readline;
+       sandbox = imports.sandbox;
+       sqlite = imports.sqlite;
+}
+catch(e)
+{
+
+}
index af4e927..cfc4f5a 100755 (executable)
@@ -1,29 +1,8 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:.*
-// STDERR:
 
-// This test is merely to appease the coverage checker (calls init in each
-// module); it will also catch unresolved symbol errors in the modules.
+testsuite = imports.testsuite
 
-try
-{
-       cairo = imports.cairo;
-       canvas = imports.canvas;
-       dbus = imports.dbus;
-       example = imports.example;
-       gettext = imports.gettext;
-       gtkbuilder = imports.gtkbuilder;
-       libxml = imports.libxml;
-       mpfr = imports.mpfr;
-       Multiprocessing = imports.Multiprocessing;
-       os = imports.os;
-       readline = imports.readline;
-       sandbox = imports.sandbox;
-       sqlite = imports.sqlite;
-}
-catch(e)
-{
+input = Seed.spawn("/usr/bin/env seed modules-noasserts.js");
+
+testsuite.assert(input.stdout == "Hello Seed Module World\n")
 
-}
index d8799f5..3820025 100755 (executable)
@@ -1,18 +1,28 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:\n\*\* \(seed:[0-9]+\): WARNING \*\*: Exception in closure marshal\. Line 12 in .*\/native-closure-exception\.js: ReferenceError Can't find variable: a
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+// TODO: shouldn't the exception be passed back to the caller?
 
-w = new Gtk.Window();
-vbox = new Gtk.VBox();
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-closure = function(widget){a.a.a;};
-w.add(vbox);
+w = new Gtk.Window()
+vbox = new Gtk.VBox()
 
-vbox.pack_start(new Gtk.Label());
+closure = function(widget){a.a.a}
+w.add(vbox)
 
-vbox.foreach(closure);
+vbox.pack_start(new Gtk.Label())
+
+try
+{
+    vbox.foreach(closure)
+    // ARST testsuite.unreachable()
+}
+catch(e)
+{
+    testsuite.assert(e instanceof ReferenceError)
+}
+
+//testsuite.checkAsserts
+print("This test doesn't work yet...")
index 90c3ebc..fdcebb3 100755 (executable)
@@ -1,19 +1,20 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[object GtkLabel\]\n\[object GtkButton\]
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-w = new Gtk.Window();
-vbox = new Gtk.VBox();
+w = new Gtk.Window()
+vbox = new Gtk.VBox()
 
-closure = function(widget){print(widget);};
-w.add(vbox);
+closure = function(widget) {
+    testsuite.assert(widget instanceof Gtk.Label || widget instanceof Gtk.Button)
+}
+w.add(vbox)
 
-vbox.pack_start(new Gtk.Label());
-vbox.pack_start(new Gtk.Button());
+vbox.pack_start(new Gtk.Label())
+vbox.pack_start(new Gtk.Button())
 
-vbox.foreach(closure);
+vbox.foreach(closure)
+
+testsuite.checkAsserts(2)
index 78a9372..36b8c9d 100755 (executable)
@@ -1,23 +1,24 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Window implements interfaces\nInterface: (Buildable|ImplementorIface)\nInterface: (Buildable|ImplementorIface)
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-GIRepository = imports.gi.GIRepository;
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+GIRepository = imports.gi.GIRepository
 
-gir = GIRepository.IRepository.get_default();
+gir = GIRepository.IRepository.get_default()
 
-info = gir.find_by_gtype(Gtk.Window.type);
-print(GIRepository.base_info_get_name(info) + " implements interfaces");
+info = gir.find_by_gtype(Gtk.Window.type)
+testsuite.assert(GIRepository.base_info_get_name(info) == "Window")
 
-n = GIRepository.object_info_get_n_interfaces(info);
+n = GIRepository.object_info_get_n_interfaces(info)
 for (i = 0; i < n; i++)
 {
-       property = GIRepository.object_info_get_interface(info, i);
-       print("Interface: " + GIRepository.base_info_get_name(property));
-       GIRepository.base_info_unref(property);
+    property = GIRepository.object_info_get_interface(info, i)
+    propertyname = GIRepository.base_info_get_name(property)
+    testsuite.assert(propertyname == "Buildable" ||
+                     propertyname == "ImplementorIface")
+    GIRepository.base_info_unref(property)
 }
 
-GIRepository.base_info_unref(info);
+GIRepository.base_info_unref(info)
+
+testsuite.checkAsserts(3)
index c048987..900b64d 100755 (executable)
@@ -1,15 +1,15 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:5 100
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
-w = new Gtk.Window({width_request: 5, height_request: 100});
-o1 = { };
-o2 = { };
+Gtk.init(Seed.argv)
 
-w.get_size_request(o1, o2);
-print(o1.value + " " +  o2.value);
+w = new Gtk.Window({width_request: 5, height_request: 100})
+o1 = { }
+o2 = { }
+
+w.get_size_request(o1, o2)
+
+testsuite.assert(o1.value == 5)
+testsuite.assert(o2.value == 100)
diff --git a/tests/javascript/print.js b/tests/javascript/print.js
deleted file mode 100755 (executable)
index ba1305b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello, world!
-// STDERR:
-
-print("Hello, world!");
diff --git a/tests/javascript/printf.js b/tests/javascript/printf.js
deleted file mode 100755 (executable)
index d0cdb7a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:string\nstring\ninteger 4\nfloat 0\.333333\nmore 0\.333333333\nless 0\.33
-// STDERR:
-
-Seed.printf("string");
-Seed.printf("%s", "string");
-Seed.printf("%s %d", "integer", 2+2);
-Seed.printf("%s %f", "float", 1/3);
-Seed.printf("%s %.9f", "more", 1/3);
-Seed.printf("%s %.2f", "less", 1/3);
diff --git a/tests/javascript/printprint.js b/tests/javascript/printprint.js
deleted file mode 100755 (executable)
index 6f3ce5b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello World!\n\[undefined\]
-// STDERR:
-
-print(print("Hello World!"));
index ba5e8c9..3a242ec 100755 (executable)
@@ -1,8 +1,6 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
+
+// TODO: this test doesn't do anything
 
 Gtk = imports.gi.Gtk;
 Gtk.init(Seed.argv);
index 139e60a..4c2b2cd 100755 (executable)
@@ -1,11 +1,20 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:\n\*\* \(seed:[0-9]+\): CRITICAL \*\*: Line 10 in .*\/property-glib-exception\.js: PropertyError value "3\.000000" of type `gdouble' is invalid or out of range for property `opacity' of type `gdouble'
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
 
-window = new Gtk.Window();
-window.opacity = 3;
+Gtk.init(Seed.argv)
+
+window = new Gtk.Window()
+
+try
+{
+    window.opacity = 3
+}
+catch(e)
+{
+    testsuite.assert(e.name == "PropertyError")
+    testsuite.assert(e.message == "value \"3.000000\" of type `gdouble' is invalid or out of range for property `opacity' of type `gdouble'")
+}
+
+testsuite.checkAsserts(2)
index 358a859..4103cc1 100755 (executable)
@@ -1,7 +1,4 @@
 #!/usr/bin/env seed
-// Returns: 1
-// STDIN:
-// STDOUT:
-// STDERR:
 
-Seed.quit(1);
+Seed.quit(0)
+imports.testsuite.unreachable()
diff --git a/tests/javascript/quit2.js b/tests/javascript/quit2.js
deleted file mode 100755 (executable)
index 1fa04d7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
-
-Seed.quit(0);
diff --git a/tests/javascript/readline-bind.js b/tests/javascript/readline-bind.js
deleted file mode 100755 (executable)
index a9c99ca..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:a2+2
-// STDOUT:Got here!\n2\+2\n4
-// STDERR:.
-
-readline = imports.readline;
-readline.bind("a", function () { print("Got here!"); });
-print(eval(readline.readline("")));
diff --git a/tests/javascript/readline.js b/tests/javascript/readline.js
deleted file mode 100755 (executable)
index 7c1069b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:2+2
-// STDOUT:2\+2\n4
-// STDERR:.
-
-readline = imports.readline;
-print(eval(readline.readline("")));
index f816e22..27f286d 100644 (file)
@@ -1,5 +1,16 @@
 EXTRA_DIST = \
        signal-connect.js \
+       signal-disconnect.js \
+       signal-exception.js \
+       signal-expects.js \
+       signal-invalid.js \
+       signal.js \
+       signal-nofunc.js \
+       signal-userdata.js \
+       testsuite.js
+
+TESTS = \
+    signal-connect.js \
        signal-disconnect.js \
        signal-exception.js \
        signal-expects.js \
index 6f63f34..38b717a 100755 (executable)
@@ -1,21 +1,19 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[object GtkButton\]\n1\n0\.5
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
 function handle_opacity_change(obj, gobject, user_data)
 {
-       print(user_data);
-       print(user_data === button);
-       print(obj.opacity);
+       testsuite.assert(user_data instanceof Gtk.Button)
+       testsuite.assert(user_data === button)
+       testsuite.assert(obj.opacity == 0.5)
 }
 
-win = new Gtk.Window();
-button = new Gtk.Button();
-win.signal.connect("notify::opacity", handle_opacity_change, button);
-win.opacity = 0.5;
+win = new Gtk.Window()
+button = new Gtk.Button()
+win.signal.connect("notify::opacity", handle_opacity_change, button)
+win.opacity = 0.5
 
+testsuite.checkAsserts(3)
index 737d4e0..df81509 100755 (executable)
@@ -1,18 +1,21 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Signal handler called
-// STDERR:
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
 
-function test(){
-    print("Signal handler called");
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
+
+myglobal = 0
+
+function test()
+{
+    myglobal += 1234
 }
 
-w = new Gtk.Window();
-id = w.signal.map.connect(test);
-w.show_all();
-w.hide();
-w.signal.disconnect(id);
-w.show_all();
+w = new Gtk.Window()
+id = w.signal.map.connect(test)
+w.show_all()
+w.hide()
+w.signal.disconnect(id)
+w.show_all()
+
+testsuite.assert(myglobal == 1234)
index 9d4c86b..860f1a7 100755 (executable)
@@ -4,10 +4,13 @@
 // STDOUT:
 // STDERR:\n\*\* \(seed:[0-9]+\): WARNING \*\*: Exception in closure .*
 
+testsuite = imports.testsuite
 Gtk = imports.gi.Gtk;
 Gtk.init(Seed.argv);
 
 w = new Gtk.Window();
 
-w.signal.map.connect(function(){3 = undefined});
-w.show();
+//w.signal.map.connect(function(){3 = undefined});
+//w.show();
+
+print("This is another one of those tests that probably doesn't chain right yet")
index cb5ac9b..56baa66 100755 (executable)
@@ -1,17 +1,17 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:In signal
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
 function expects_test(widget, user_data)
 {
-    print("In signal");
+    testsuite.assert(widget == w)
+    testsuite.assert(user_data == null)
 }
 
-w = new Gtk.Window();
-w.signal.map.connect(expects_test);
-w.show();
+w = new Gtk.Window()
+w.signal.map.connect(expects_test)
+w.show()
+
+testsuite.checkAsserts(2)
index 93bc89b..9d4fe6b 100755 (executable)
@@ -1,10 +1,9 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[undefined\]
-// STDERR:
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
 
-w = new Gtk.Window();
-print(w.signal.notasignal);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
+
+w = new Gtk.Window()
+
+testsuite.assert(w.signal.notasignal == undefined)
index a661d62..71ca071 100755 (executable)
@@ -1,15 +1,19 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Signal connection requires a function as first argument
-// STDERR:
+
+testsuite = imports.testsuite
 Gtk = imports.gi.Gtk;
 Gtk.init(Seed.argv);
 
 w = new Gtk.Window();
-try{
+
+try
+{
     w.signal.map.connect(3);
+    testsuite.unreachable()
 }
-catch (e){
-    print(e.message);
+catch (e)
+{
+    testsuite.assert(e.message == "Signal connection requires a function as first argument")
 }
+
+testsuite.checkAsserts(1)
index f163a72..c18d717 100755 (executable)
@@ -1,9 +1,6 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\{"Hello":"World"\}
-// STDERR:
 
+testsuite = imports.testsuite
 Gtk = imports.gi.Gtk;
 JSON = imports.JSON;
 
@@ -11,9 +8,11 @@ Gtk.init(Seed.argv);
 
 function userdata_test(widget, user_data)
 {
-    print(JSON.stringify(user_data));
+    testsuite.assert(user_data.Hello == "World")
 }
 
 w = new Gtk.Window();
 w.signal.map.connect(userdata_test, {Hello: "World"});
 w.show();
+
+testsuite.checkAsserts(1)
index f01eda3..41b6fa3 100755 (executable)
@@ -1,18 +1,17 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Window mapped.
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
 function mapped(window)
 {
-    print("Window mapped.");
+    testsuite.assert(window == w)
 }
 
-w = new Gtk.Window();
-w.signal.map.connect(mapped);
+w = new Gtk.Window()
+w.signal.map.connect(mapped)
 
-w.show_all();
+w.show_all()
+
+testsuite.checkAsserts(1)
diff --git a/tests/javascript/signals/testsuite.js b/tests/javascript/signals/testsuite.js
new file mode 120000 (symlink)
index 0000000..78d069d
--- /dev/null
@@ -0,0 +1 @@
+../testsuite.js
\ No newline at end of file
diff --git a/tests/javascript/spawn.js b/tests/javascript/spawn.js
deleted file mode 100755 (executable)
index 400dd96..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Hello, world!
-// STDERR:
-
-var input = Seed.spawn("seed print.js");
-print(input.stdout);
index 0afeacf..0d02392 100755 (executable)
@@ -1,27 +1,32 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\{"t1key":"1","data":"This is sample data","num":"3\.0","timeEnter":null\}\n\{"t1key":"2","data":"More sample data","num":"6\.0","timeEnter":null\}\n\{"t1key":"3","data":"And a little more","num":"9\.0","timeEnter":null\}
-// STDERR:
-Gio = imports.gi.Gio;
-sqlite = imports.sqlite;
-JSON = imports.JSON;
 
-try{
-    Gio.file_new_for_path("/tmp/.seed_test.db")["delete"]();
+testsuite = imports.testsuite
+Gio = imports.gi.Gio
+sqlite = imports.sqlite
+JSON = imports.JSON
+
+try
+{
+    Gio.file_new_for_path("/tmp/.seed_test.db")["delete"]()
 }
-catch(e){
+catch(e)
+{
+    // We don't care if we fail to delete the (probably nonexistent) file...
 }
 
-d = new sqlite.Database("/tmp/.seed_test.db");
+d = new sqlite.Database("/tmp/.seed_test.db")
+
+d.exec("create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE)")
+d.exec("insert into t1 (data,num) values ('This is sample data',3)")
+d.exec("insert into t1 (data,num) values ('More sample data',6)")
+d.exec("insert into t1 (data,num) values ('And a little more',9)")
 
-d.exec("create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE);");
-d.exec("insert into t1 (data,num) values ('This is sample data',3);");
-d.exec("insert into t1 (data,num) values ('More sample data',6);");
-d.exec("insert into t1 (data,num) values ('And a little more',9);");
+d.exec("select * from t1 where num = 6", function(results) {
+    testsuite.assert(results.t1key == "2")
+    testsuite.assert(results.data == "More sample data")
+    testsuite.assert(results.num == 6.0)
+})
 
-d.exec("select * from t1", function(results){
-    print(JSON.stringify(results));
-});
+d.close()
 
-d.close();
+testsuite.checkAsserts(3)
index 62a22b1..81044ea 100644 (file)
@@ -1,4 +1,14 @@
 EXTRA_DIST = \
+       struct-functions.js \
+       struct-set-member.js \
+       struct-constructor.js \
+       struct-nested-set.js \
+       struct-union-enumerate.js \
+       struct-enumerate.js \
+       struct-offsets.js \
+       testsuite.js
+
+TESTS = \
        struct-functions.js \
        struct-set-member.js \
        struct-constructor.js \
index 5c56d35..bff4f09 100755 (executable)
@@ -1,13 +1,10 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:100\n90\n80
-// STDERR:
 
-Gdk = imports.gi.Gdk;
+testsuite = imports.testsuite
+Gdk = imports.gi.Gdk
 
-c = new Gdk.Color({red: 100});
-print(c.red);
-c = new Gdk.Color({red: 90, blue: 80});
-print(c.red);
-print(c.blue);
+c = new Gdk.Color({red: 100})
+testsuite.assert(c.red == 100)
+c = new Gdk.Color({red: 90, blue: 80})
+testsuite.assert(c.red == 90)
+testsuite.assert(c.blue == 80)
index 54456a5..4ddc1c9 100755 (executable)
@@ -1,13 +1,13 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:x\ny\nwidth\nheight\nintersect\nunion
-// STDERR:
 
-Gdk = imports.gi.Gdk;
+testsuite = imports.testsuite
+Gdk = imports.gi.Gdk
 
-r = new Gdk.Rectangle();
+r = new Gdk.Rectangle()
 for (prop in r)
 {
-       print(prop);
+       testsuite.assert(prop == "x" || prop == "y" || prop == "width" || 
+                        prop == "height" || prop == "intersect" || prop == "union")
 }
+
+testsuite.checkAsserts(6)
index 9bc8978..31fb769 100755 (executable)
@@ -1,11 +1,10 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:
-// STDERR:
 
-GConf = imports.gi.GConf;
+testsuite = imports.testsuite
+GConf = imports.gi.GConf
 
-GConf.init(Seed.argv);
+GConf.init(Seed.argv)
 
-client = GConf.Client.get_default();
+client = GConf.Client.get_default()
+
+testsuite.assert(client != undefined)
index f8fb138..7787fe9 100755 (executable)
@@ -1,20 +1,17 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\[object seed_union\]\n1\n300\n400
-// STDERR:
 
-Gdk = imports.gi.Gdk;
+testsuite = imports.testsuite
+Gdk = imports.gi.Gdk
 
-e = new Gdk.Event();
-print(e);
+e = new Gdk.Event()
+testsuite.assert(e.toString() == "[object seed_union]")
 
-e.type = Gdk.EventType.EXPOSE;
-print(Gdk.EventType.EXPOSE == e.type);
+e.type = Gdk.EventType.EXPOSE
+testsuite.assert(Gdk.EventType.EXPOSE == e.type)
 
-r = new Gdk.Rectangle();
-r.x = 300;
-e.rectangle = r;
-print(e.rectangle.x);
-e.rectangle.x = 400;
-print(e.rectangle.x);
\ No newline at end of file
+r = new Gdk.Rectangle()
+r.x = 300
+e.rectangle = r
+testsuite.assert(e.rectangle.x == 300)
+e.rectangle.x = 400
+testsuite.assert(e.rectangle.x == 400)
index 58ca906..4c8a8c7 100755 (executable)
@@ -1,13 +1,10 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:17\n0
-// STDERR:
 
-Pango = imports.gi.Pango;
+testsuite = imports.testsuite
+Pango = imports.gi.Pango
 
-c = new Pango.Color();
-c.red = 17;
+c = new Pango.Color()
+c.red = 17
 
-print(c.red);
-print(c.blue);
+testsuite.assert(c.red == 17)
+testsuite.assert(c.blue == 0)
index 2e05795..d6ebb79 100755 (executable)
@@ -1,12 +1,9 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:0\n200
-// STDERR:
 
-Gdk = imports.gi.Gdk;
+testsuite = imports.testsuite
+Gdk = imports.gi.Gdk
 
-color = new Gdk.Color();
-print(color.red);
-color.red = 200;
-print(color.red);
+color = new Gdk.Color()
+testsuite.assert(color.red == 0)
+color.red = 200
+testsuite.assert(color.red == 200)
index 7ddfbc7..81ab3cd 100755 (executable)
@@ -1,26 +1,30 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:\* type\n\* any\n   \* type\n   \* window\n   \* send_event\n\* expose\n   \* type\n   \* window\n   \* send_event\n   \* area\n      \* x\n      \* y\n      \* width\n      \* height\n      \* intersect\n      \* union\n   \* region\n      \* copy\n      \* destroy\n      \* get_clipbox\n      \* get_rectangles\n      \* empty\n      \* equal\n      \* rect_equal\n      \* point_in\n      \* rect_in\n      \* offset\n      \* shrink\n      \* union_with_rect\n      \* intersect\n      \* union\n      \* subtract\n      \* xor\n      \* spans_intersect_foreach\n   \* count\n\* no_expose\n   \* type\n   \* window\n   \* send_event\n\* visibility\n   \* type\n   \* window\n   \* send_event\n   \* state\n\* motion\n   \* type\n   \* window\n   \* send_event\n   \* time\n   \* x\n   \* y\n   \* axes\n   \* state\n   \* is_hint\n   \* device\n   \* x_root\n   \* y_root\n\* button\n   \* type\n   \* window\n   \* send_event\n   \* time\n   \* x\n   \* y\n   \* axes\n   \* state\n   \* button\n   \* device\n   \* x_root\n   \* y_root\n\* scroll\n   \* type\n   \* window\n   \* send_event\n   \* time\n   \* x\n   \* y\n   \* state\n   \* direction\n   \* device\n   \* x_root\n   \* y_root\n\* key\n   \* type\n   \* window\n   \* send_event\n   \* time\n   \* state\n   \* keyval\n   \* length\n   \* string\n   \* hardware_keycode\n   \* group\n   \* is_modifier\n\* crossing\n   \* type\n   \* window\n   \* send_event\n   \* subwindow\n   \* time\n   \* x\n   \* y\n   \* x_root\n   \* y_root\n   \* mode\n   \* detail\n   \* focus\n   \* state\n\* focus_change\n   \* type\n   \* window\n   \* send_event\n   \* in\n\* configure\n   \* type\n   \* window\n   \* send_event\n   \* x\n   \* y\n   \* width\n   \* height\n\* property\n   \* type\n   \* window\n   \* send_event\n   \* atom\n      \* name\n   \* time\n   \* state\n\* selection\n   \* type\n   \* window\n   \* send_event\n   \* selection\n      \* name\n   \* target\n      \* name\n   \* property\n      \* name\n   \* time\n   \* requestor\n\* owner_change\n   \* type\n   \* window\n   \* send_event\n   \* owner\n   \* reason\n   \* selection\n      \* name\n   \* time\n   \* selection_time\n\* proximity\n   \* type\n   \* window\n   \* send_event\n   \* time\n   \* device\n\* client\n   \* type\n   \* window\n   \* send_event\n   \* message_type\n      \* name\n\* dnd\n   \* type\n   \* window\n   \* send_event\n   \* context\n   \* time\n\* window_state\n   \* type\n   \* window\n   \* send_event\n   \* changed_mask\n   \* new_window_state\n\* setting\n   \* type\n   \* window\n   \* send_event\n   \* action\n   \* name\n\* grab_broken\n   \* type\n   \* window\n   \* send_event\n   \* keyboard\n   \* implicit\n   \* grab_window\n\* put\n\* copy\n\* free\n\* get_time\n\* get_state\n\* get_coords\n\* get_root_coords\n\* get_axis\n\* set_screen\n\* get_screen\n\* send_client_message\n\* send_clientmessage_toall\n\* get_symbol
-// STDERR:
 
-// TODO: enum methods work now. do we support them?
-// We don't here! They're what broke this test...
+// The way this test stood, it didn't make any sense. It still doesn't, but
+// at least now it's not fragile based on Gdk version, and will still be
+// triggered by the only flaw this test has ever caught...
 
-Gdk = imports.gi.Gdk;
+testsuite = imports.testsuite
+Gdk = imports.gi.Gdk
+
+maxindent = 0
+propcount = 0
 
 function enum_structlike(indent, e)
 {
+    if(indent > maxindent)
+        maxindent = indent
+    
        for (prop in e)
        {
-               print(indent + "* " + prop);
-               
+           propcount++
+           
                try
                {
                        if (e[prop] && e[prop].toString() && 
                                (e[prop].toString().search("struct") > 0 ||
                                e[prop].toString().search("union") > 0))
-                               enum_structlike(indent + "   ", e[prop]);
+                               enum_structlike(indent + 1, e[prop])
                }
                catch(e)
                {
@@ -29,6 +33,9 @@ function enum_structlike(indent, e)
        }
 }
 
-e = new Gdk.Event();
+e = new Gdk.Event()
+
+enum_structlike(0, e)
 
-enum_structlike("", e);
+testsuite.assert(maxindent >= 2)
+testsuite.assert(propcount >= 50)
diff --git a/tests/javascript/structs/testsuite.js b/tests/javascript/structs/testsuite.js
new file mode 120000 (symlink)
index 0000000..78d069d
--- /dev/null
@@ -0,0 +1 @@
+../testsuite.js
\ No newline at end of file
diff --git a/tests/javascript/syntax-test-noasserts.js b/tests/javascript/syntax-test-noasserts.js
new file mode 100755 (executable)
index 0000000..a0e12f1
--- /dev/null
@@ -0,0 +1 @@
+new = 3
index 15f0a02..33dae46 100755 (executable)
@@ -1,7 +1,15 @@
 #!/usr/bin/env seed
-// Returns: 1
-// STDIN:
-// STDOUT:
-// STDERR:\n\*\* \(seed:[0-9]+\): CRITICAL \*\*: Line 6 in .*\/syntax-test\.js: SyntaxError Parse error
 
-new = 3
+testsuite = imports.testsuite
+
+try
+{
+    eval("new = 3")
+    testsuite.unreachable()
+}
+catch(e)
+{
+    testsuite.assert(e instanceof SyntaxError)
+}
+
+testsuite.checkAsserts(1)
diff --git a/tests/javascript/testsuite.js b/tests/javascript/testsuite.js
new file mode 100755 (executable)
index 0000000..a4d845e
--- /dev/null
@@ -0,0 +1,32 @@
+assertCount = 0
+
+function assert(a, err)
+{
+    assertCount++
+    
+    if(!a)
+    {
+        if(err)
+            print("Assertion " + assertCount + " failed: " + err + ".")
+        else
+            print("Assertion " + assertCount + " failed.")
+        
+        Seed.quit(assertCount)
+    }
+}
+
+function unreachable(err)
+{
+    if(err)
+        print("Unreachable code reached: " + err.toString() + ".")
+    else
+        print("Unreachable code reached.")
+    
+    Seed.quit(1)
+}
+
+function checkAsserts(n)
+{
+    if(assertCount != n)
+        assert(0, "Some assertions failed to run")
+}
index 9a397c1..3ed7d97 100755 (executable)
@@ -1,27 +1,29 @@
 #!/usr/bin/env seed
-// Returns: 0
-// STDIN:
-// STDOUT:Can not convert Javascript value to boolean\nCan not convert Javascript value to int
-// STDERR:
 
-Gtk = imports.gi.Gtk;
-Gtk.init(Seed.argv);
+testsuite = imports.testsuite
+Gtk = imports.gi.Gtk
+Gtk.init(Seed.argv)
 
-actor = new Gtk.Window();
-tests = [
-       "actor.accept_focus = 'hello'",
-       "actor.default_width = actor"];
+actor = new Gtk.Window()
 
-
-for ( i in tests )
+try
+{
+    actor.accept_focus = 'hello'
+    testsuite.unreachable()
+}
+catch(e)
 {
-       try
-       {
-               eval(tests[i]);
-       }
-       catch (e)
-       {
-               print(e.message);
-       }
+    testsuite.assert(e.message = "Can not convert Javascript value to boolean")
+}
 
+try
+{
+    actor.default_width = actor
+    testsuite.unreachable()
+}
+catch(e)
+{
+    testsuite.assert(e.message = "Can not convert Javascript value to int")
 }
+
+testsuite.checkAsserts(2)
diff --git a/tests/make-test.py b/tests/make-test.py
deleted file mode 100755 (executable)
index 8faa89f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-
-import os
-import re
-import sys
-import stat
-
-rfile = open(sys.argv[1], "r")
-test_code = rfile.readlines()
-
-if(test_code[1].find("// STDIN") >= 0):
-    test_in = test_code[1].replace("// STDIN:","").rstrip().replace("\\n","\n")
-else:
-    test_in = ""
-
-os.system("chmod +x " + sys.argv[1])
-(n,out,err) = os.popen3("./" + sys.argv[1])
-
-if(test_in != ""):
-       n.write(test_in + "\004")
-       n.close()
-
-outf = open(sys.argv[1].replace("_.js",".js"),"w")
-
-def sanitize(san):
-    san = san.replace("\\","\\\\");
-    san = san.replace("(","\(");
-    san = san.replace(")","\)");
-    san = san.replace("[","\[");
-    san = san.replace("]","\]");
-    san = san.replace("{","\{");
-    san = san.replace("}","\}");
-    san = san.replace(".","\.");
-    san = san.replace("*","\*");
-    san = san.replace("$","\$");
-    san = san.replace("^","\^");
-    san = san.replace("/","\/");
-    san = san.replace("+","\+");
-    san = san.replace("\n","\\n");
-    return san
-
-outf.write(test_code[0])
-outf.write("// Returns: 0\n")
-outf.write("// STDIN:" + test_in + "\n")
-outf.write("// STDOUT:" + sanitize("".join(out.readlines()).rstrip()) + "\n")
-outf.write("// STDERR:" + sanitize("".join(err.readlines()).rstrip()) + "\n")
-
-if(test_in != ""):
-       outf.write("".join(test_code[2:]))
-else:
-       outf.write("".join(test_code[1:]))
-
-outf.close()
-
-os.chmod(sys.argv[1].replace("_.js",".js"), stat.S_IREAD | stat.S_IEXEC | stat.S_IWRITE)
diff --git a/tests/run-tests.py b/tests/run-tests.py
deleted file mode 100755 (executable)
index 8684083..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/python
-
-################################
-#   Seed Unit Test Framework   #
-################################
-
-import os
-import re
-import sys
-import subprocess
-import difflib
-
-passed = []
-failed = []
-
-mcwd = os.getcwd()
-
-for root, dirs, files in os.walk(os.path.join(mcwd,"javascript")):
-       for filename in files:
-               f = os.path.join(root, filename)
-               if f.endswith(".js") and not f.endswith("_.js") and not os.path.basename(f).startswith("."):
-                       attempts = 0
-                       while attempts < 10:
-                               try:
-                                       rfile = open(f, "r")
-                                       test_code = rfile.readlines()
-                                       test_retval = int(test_code[1].replace("// Returns:","").rstrip().replace("\\n","\n"));
-                                       test_in = test_code[2].replace("// STDIN:","").rstrip().replace("\\n","\n");
-                                       test_out = "^" + test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n") + "$";
-                                       test_err = "^" + test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n") + "$";
-
-                                       p = subprocess.Popen(f, shell=True,
-                                                                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-                                                                stderr=subprocess.PIPE, close_fds=True,
-                                                                cwd=os.path.join(mcwd,"javascript"))
-                                       (out,err)=(p.stdout, p.stderr)
-
-                                       (run_out,run_err)=p.communicate(test_in + "\004")
-                                       run_out = run_out.rstrip()
-                                       run_err = run_err.rstrip()
-                                       run_err = re.sub("Xlib:  extension \".*\" missing on display \".*\".\n?","",run_err)
-
-                                       out.close()
-                                       err.close()
-
-                                       if not re.match(test_out,run_out):
-                                               failed.append([filename,test_out,run_out,0,run_err])
-                                               sys.stdout.write("x")
-                                       elif not re.match(test_err,run_err):
-                                               failed.append([filename,test_err,run_err,1])
-                                               sys.stdout.write("x")
-                                       elif p.returncode != test_retval:
-                                               failed.append([filename,test_retval,p.returncode,2]);
-                                               sys.stdout.write("x")
-                                       else:
-                                               passed.append([filename])
-                                               sys.stdout.write(".")
-                                               sys.stdout.flush()
-                                       break
-                               except:
-                                       attempts += 1
-                       if attempts == 10:
-                               print "WARNING: Strange error in " + f + "\n\n"
-
-p = subprocess.Popen(os.path.join(mcwd, "c", "test"), shell=True,
-                    stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-                    stderr=subprocess.PIPE, close_fds=True);
-(c_out, c_err) = p.communicate()
-
-for c_test in c_out.rstrip().split("\n"):
-       c_status = c_test.split(": ");
-       a_error = c_err.rstrip().replace("**\nERROR:","").replace("\nAborted","")
-       if (len(c_status) < 2) or (c_status[1] != "OK"):
-               failed.append(["c_test" + c_status[0], "OK", a_error,1])
-               sys.stdout.write(".")
-       else:
-               passed.append([c_status[0]])
-       sys.stdout.flush()
-
-print
-
-print "libseed test run:"
-print "%d tests passed; %d tests failed.\n" % (len(passed), len(failed))
-for fail in failed:
-       print "-------------FAILED TEST---------------"
-       print "Name: %s" % fail[0]
-       if fail[3] == 1:
-               for line in difflib.unified_diff(fail[1].replace("\\","").replace("^","").replace("$","").split("\n"),
-                                                fail[2].split("\n"),
-                                                fromfile="Expected Error",
-                                                tofile="Actual Error"):
-                       print line.rstrip()
-       elif fail[3] == 0:
-               for line in difflib.unified_diff(fail[1].replace("\\","").replace("^","").replace("$","").split("\n"),
-                                                fail[2].split("\n"),
-                                                fromfile="Expected Output",
-                                                tofile="Actual Output"):
-                       print line.rstrip()
-               print "  Error Output:\t\t" + fail[4]
-       elif fail[3] == 2:
-               print "  Expected Retval:\t%d" % fail[1]
-               print "  Actual Retval:\t%d" % fail[2]
-if len(failed):
-       print "---------------------------------------"