[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    tests/khtmltests/regression/tests/js
From:       Harri Porten <porten () kde ! org>
Date:       2007-03-21 4:40:56
Message-ID: 1174452056.833276.17071.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 644862 by porten:

we had this function before. where did it go?


 M  +30 -0     base.js  


--- trunk/tests/khtmltests/regression/tests/js/base.js #644861:644862
@@ -12,6 +12,11 @@
   // regtest.reportResult(false, msg);  
 }
 
+function description(s)
+{
+    debug(s);
+}
+
 function shouldBe(_a, _b)
 {
   if (typeof _a != "string" || typeof _b != "string")
@@ -37,3 +42,28 @@
   else
     testFailed(_a + " should be undefined. Was " + _av);
 }
+
+function shouldThrow(_a, _e)
+{
+  var exception;
+  var _av;
+  try {
+     _av = eval(_a);
+  } catch (e) {
+     exception = e;
+  }
+
+  var _ev;
+  if (_e)
+      _ev =  eval(_e);
+
+  if (exception) {
+    if (typeof _e == "undefined" || exception == _ev)
+      testPassed(_a + " threw exception " + exception + ".");
+    else
+      testFailed(_a + " should throw exception " + _ev + ". Threw exception " + exception + ".");
+  } else if (typeof _av == "undefined")
+    testFailed(_a + " should throw exception " + _e + ". Was undefined.");
+  else
+    testFailed(_a + " should throw exception " + _e + ". Was " + _av + ".");
+}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic