gjs r57 - in trunk: . test/js
- From: jobi svn gnome org
- To: svn-commits-list gnome org
- Subject: gjs r57 - in trunk: . test/js
- Date: Fri, 24 Oct 2008 15:17:17 +0000 (UTC)
Author: jobi
Date: Fri Oct 24 15:17:17 2008
New Revision: 57
URL: http://svn.gnome.org/viewvc/gjs?rev=57&view=rev
Log:
Add testself.js
Added:
trunk/test/js/testself.js
Modified:
trunk/Makefile-test.am
Modified: trunk/Makefile-test.am
==============================================================================
--- trunk/Makefile-test.am (original)
+++ trunk/Makefile-test.am Fri Oct 24 15:17:17 2008
@@ -74,6 +74,7 @@
EXTRA_DIST += \
test/js/modules/jsUnit.js \
+ test/js/testself.js \
test/js/testLang.js \
test/js/testMainloop.js \
test/js/testSignals.js \
Added: trunk/test/js/testself.js
==============================================================================
--- (empty file)
+++ trunk/test/js/testself.js Fri Oct 24 15:17:17 2008
@@ -0,0 +1,35 @@
+var someUndefined;
+var someNumber = 1;
+var someOtherNumber = 42;
+var someString = "hello";
+var someOtherString = "world";
+
+assert(true);
+assertTrue(true);
+assertFalse(false);
+
+assertEquals(someNumber, someNumber);
+assertEquals(someString, someString);
+
+assertNotEquals(someNumber, someOtherNumber);
+assertNotEquals(someString, someOtherString);
+
+assertNull(null);
+assertNotNull(someNumber);
+assertUndefined(someUndefined);
+assertNotUndefined(someNumber);
+assertNaN(0/0);
+assertNotNaN(someNumber);
+
+// test assertRaises()
+assertRaises(function() { throw new Object(); });
+try { // calling assertRaises with non-function is an error, not assertion failure
+ assertRaises(true);
+} catch(e) {
+ assertUndefined(e.isJsUnitException);
+}
+try { // function not throwing an exception is assertion failure
+ assertRaises(function() { return true; });
+} catch(e) {
+ assertTrue(e.isJsUnitException);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]