Add todo_is and todo_isnot functions. b=377721 r=sayrer
authordbaron@dbaron.org
Mon, 16 Apr 2007 18:06:42 -0700
changeset 571 01b0198b645643c397d22b056590956c3e732b5a
parent 570 bf4ee8616ab8620d17d90c87eadbab782fd445b3
child 572 2eaf4545bec3c303a80c3ddcfabd6eb024eace15
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssayrer
bugs377721
milestone1.9a4pre
Add todo_is and todo_isnot functions. b=377721 r=sayrer
testing/mochitest/tests/SimpleTest/SimpleTest.js
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -74,16 +74,30 @@ SimpleTest._logResult = function(test, p
       msg += " | " + test.diag;
       if (test.todo)
           parentRunner.logger.log(msg)
       else
           parentRunner.logger.error(msg);
   }
 }
 
+/**
+ * Copies of is and isnot with the call to ok replaced by a call to todo.
+**/
+
+SimpleTest.todo_is = function (a, b, name) {
+    var repr = MochiKit.Base.repr;
+    SimpleTest.todo(a == b, name, "got " + repr(a) + ", expected " + repr(b));
+};
+
+SimpleTest.todo_isnot = function (a, b, name) {
+    var repr = MochiKit.Base.repr;
+    SimpleTest.todo(a != b, name, "Didn't expect " + repr(a) + ", but got it.");
+};
+
 
 /**
  * Makes a test report, returns it as a DIV element.
 **/
 SimpleTest.report = function () {
     var DIV = MochiKit.DOM.DIV;
     var passed = 0;
     var failed = 0;
@@ -397,16 +411,18 @@ SimpleTest.isa = function (object, clas)
     return SimpleTest.typeOf(object) == clas;
 };
 
 // Global symbols:
 var ok = SimpleTest.ok;
 var is = SimpleTest.is;
 var isnot = SimpleTest.isnot;
 var todo = SimpleTest.todo;
+var todo_is = SimpleTest.todo_is;
+var todo_isnot = SimpleTest.todo_isnot;
 var isDeeply = SimpleTest.isDeeply;
 var oldOnError = window.onerror;
 window.onerror = function (ev) {
     is(0, 1, "Error thrown during test: " + ev);
     if (oldOnError) {
 	try {
 	  oldOnError(ev);
 	} catch (e) {