| 11 | | tests.register("tests.smokeTest", |
| 12 | | [ |
| 13 | | function sanityCheckHarness(t){ |
| 14 | | // sanity checks |
| 15 | | t.assertTrue(true); |
| 16 | | t.assertFalse(false); |
| 17 | | t.assertFalse(0); |
| 18 | | t.assertFalse(null); |
| 19 | | var tObj = { w00t: false, blarg: true }; |
| 20 | | t.assertEqual( |
| 21 | | ["thinger", "blah", tObj], |
| 22 | | ["thinger", "blah", tObj] |
| 23 | | ); |
| 24 | | t.assertEqual(tObj, tObj); |
| 25 | | }, |
| 26 | | /* |
| 27 | | // uncomment to tests exception handling |
| 28 | | function sanityCheckassertTrue(t){ |
| 29 | | // should throw an error |
| 30 | | t.assertTrue(false); |
| 31 | | }, |
| 32 | | function sanityCheckassertFalse(t){ |
| 33 | | // should throw an error |
| 34 | | t.assertFalse(true); |
| 35 | | }, |
| 36 | | function sanityCheckassertEqual(t){ |
| 37 | | // should throw an error |
| 38 | | t.assertEqual("foo", "bar"); |
| 39 | | }, |
| 40 | | */ |
| 41 | | { |
| 42 | | name: "eqTest", |
| 43 | | // smoke test the fixture system |
| 44 | | setUp: function(t){ |
| 45 | | this.foo = "blah"; |
| | 12 | tests.register("tests.smokeTest", |
| | 13 | [ |
| | 14 | function sanityCheckHarness(t){ |
| | 15 | // sanity checks |
| | 16 | t.assertTrue(true); |
| | 17 | t.assertFalse(false); |
| | 18 | t.assertFalse(0); |
| | 19 | t.assertFalse(null); |
| | 20 | var tObj = { w00t: false, blarg: true }; |
| | 21 | t.assertEqual( |
| | 22 | ["thinger", "blah", tObj], |
| | 23 | ["thinger", "blah", tObj] |
| | 24 | ); |
| | 25 | t.assertEqual(tObj, tObj); |
| 50 | | tearDown: function(t){ |
| 51 | | } |
| 52 | | } |
| 53 | | ] |
| 54 | | ); |
| 55 | | |
| 56 | | if(testGlobal["dojo"]){ |
| 57 | | tests.register("tests._base", |
| 58 | | [ |
| 59 | | function dojoIsAvailable(t){ |
| 60 | | t.assertTrue(testGlobal["dojo"]); |
| 61 | | } |
| 62 | | ] |
| 63 | | ); |
| 64 | | } |
| 65 | | |
| 66 | | if(testGlobal["setTimeout"]){ |
| 67 | | // a stone-stupid async test |
| 68 | | tests.register("tests.async", |
| 69 | | [ |
| | 33 | function sanityCheckassertFalse(t){ |
| | 34 | // should throw an error |
| | 35 | t.assertFalse(true); |
| | 36 | }, |
| | 37 | function sanityCheckassertEqual(t){ |
| | 38 | // should throw an error |
| | 39 | t.assertEqual("foo", "bar"); |
| | 40 | }, |
| | 41 | */ |
| | 56 | |
| | 57 | if(testGlobal["dojo"]){ |
| | 58 | tests.register("tests._base", |
| | 59 | [ |
| | 60 | function dojoIsAvailable(t){ |
| | 61 | t.assertTrue(testGlobal["dojo"]); |
| | 62 | } |
| | 63 | ] |
| | 64 | ); |
| | 65 | } |
| | 66 | |
| | 67 | if(testGlobal["setTimeout"]){ |
| | 68 | // a stone-stupid async test |
| | 69 | tests.register("tests.async", |
| | 70 | [ |
| | 71 | { |
| | 72 | name: "deferredSuccess", |
| | 73 | runTest: function(t){ |
| | 74 | var d = new tests.Deferred(); |
| | 75 | setTimeout(d.getTestCallback(function(){ |
| | 76 | t.assertTrue(true); |
| | 77 | t.assertFalse(false); |
| | 78 | }), 50); |
| | 79 | return d; |
| | 80 | } |
| | 81 | }, |
| | 82 | { |
| | 83 | name: "deferredFailure", |
| | 84 | runTest: function(t){ |
| | 85 | var d = new tests.Deferred(); |
| | 86 | setTimeout(function(){ |
| | 87 | d.errback(new Error("hrm...")); |
| | 88 | }, 50); |
| | 89 | return d; |
| | 90 | } |
| | 91 | }, |
| | 92 | { |
| | 93 | name: "timeoutFailure", |
| | 94 | timeout: 50, |
| | 95 | runTest: function(t){ |
| | 96 | // timeout of 50 |
| | 97 | var d = new tests.Deferred(); |
| | 98 | setTimeout(function(){ |
| | 99 | d.callback(true); |
| | 100 | }, 100); |
| | 101 | return d; |
| | 102 | } |
| | 103 | } |
| | 104 | ] |
| | 105 | ); |
| | 106 | } |