Changeset 7631
- Timestamp:
- 03/17/07 20:36:54 (22 months ago)
- Location:
- dojo/trunk/tests
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
dojo/trunk/tests/runner.js
r7628 r7631 430 430 // 431 431 432 tests. isTrue = function(/*Object*/ condition){432 tests.assertTrue = function(/*Object*/ condition){ 433 433 // summary: 434 434 // is the passed item "truthy"? 435 435 if(!eval(condition)){ 436 throw tests._AssertFailure(" isTrue('" + condition + "') failed");437 } 438 } 439 440 tests. isFalse = function(/*Object*/ condition){436 throw tests._AssertFailure("assertTrue('" + condition + "') failed"); 437 } 438 } 439 440 tests.assertFalse = function(/*Object*/ condition){ 441 441 // summary: 442 442 // is the passed item "falsey"? 443 443 if(eval(condition)){ 444 throw tests._AssertFailure(" isFalse('" + condition + "') failed");445 } 446 } 447 448 tests. isEq= function(/*Object*/ expected, /*Object*/ actual){444 throw tests._AssertFailure("assertFalse('" + condition + "') failed"); 445 } 446 } 447 448 tests.assertEqual = function(/*Object*/ expected, /*Object*/ actual){ 449 449 // summary: 450 450 // are the passed expected and actual objects/values deeply … … 467 467 return true; 468 468 } 469 throw new tests._AssertFailure(" isEq() failed: expected |"+expected+"| but got |"+actual+"|");469 throw new tests._AssertFailure("assertEqual() failed: expected |"+expected+"| but got |"+actual+"|"); 470 470 } 471 471 … … 474 474 // FIXME: we're not handling circular refs. Do we care? 475 475 for(var x=0; x<expected.length; x++){ 476 if(!tests. isEq(expected[x], actual[x])){ return false; }476 if(!tests.assertEqual(expected[x], actual[x])){ return false; } 477 477 } 478 478 return true; … … 481 481 tests._objPropEq = function(expected, actual){ 482 482 for(var x in expected){ 483 if(!tests. isEq(expected[x], actual[x])){483 if(!tests.assertEqual(expected[x], actual[x])){ 484 484 return false; 485 485 } -
dojo/trunk/tests/_base.js
r7628 r7631 12 12 function sanityCheckHarness(t){ 13 13 // sanity checks 14 t. isTrue(true);15 t. isFalse(false);16 t. isFalse(0);17 t. isFalse(null);14 t.assertTrue(true); 15 t.assertFalse(false); 16 t.assertFalse(0); 17 t.assertFalse(null); 18 18 var tObj = { w00t: false, blarg: true }; 19 t. isEq(19 t.assertEqual( 20 20 ["thinger", "blah", tObj], 21 21 ["thinger", "blah", tObj] 22 22 ); 23 t. isEq(tObj, tObj);23 t.assertEqual(tObj, tObj); 24 24 }, 25 25 /* 26 26 // uncomment to tests exception handling 27 function sanityCheck IsTrue(t){27 function sanityCheckassertTrue(t){ 28 28 // should throw an error 29 t. isTrue(false);29 t.assertTrue(false); 30 30 }, 31 function sanityCheck IsFalse(t){31 function sanityCheckassertFalse(t){ 32 32 // should throw an error 33 t. isFalse(true);33 t.assertFalse(true); 34 34 }, 35 function sanityCheck IsEq(t){35 function sanityCheckassertEqual(t){ 36 36 // should throw an error 37 t. isEq("foo", "bar");37 t.assertEqual("foo", "bar"); 38 38 }, 39 39 */ … … 45 45 }, 46 46 runTest: function(t){ 47 t. isEq("blah", this.foo);47 t.assertEqual("blah", this.foo); 48 48 }, 49 49 tearDown: function(t){ … … 57 57 [ 58 58 function dojoIsAvailable(t){ 59 t. isTrue(testGlobal["dojo"]);59 t.assertTrue(testGlobal["dojo"]); 60 60 } 61 61 ] … … 72 72 var d = new tests.Deferred(); 73 73 setTimeout(d.getTestCallback(function(){ 74 t. isTrue(true);75 t. isFalse(false);74 t.assertTrue(true); 75 t.assertFalse(false); 76 76 }), 50); 77 77 return d;