Created
May 29, 2012 13:30
-
-
Save sole/2828389 to your computer and use it in GitHub Desktop.
munit.js advanced example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var array; | |
var arrayTest = new MUNIT.Test([ | |
function lengthZeroWhenEmpty() { | |
this.assertEquals(0, array.length); | |
}, | |
function lengthNotZeroIfNotEmpty() { | |
array.push(1); | |
this.assertTrue(array.length != 0); | |
}, | |
function arrayIsRecreatedAfterEachTest() { | |
this.assertEquals(0, array.length); | |
} | |
]); | |
arrayTest.onSetup = function() { | |
array = []; | |
} | |
arrayTest.onTearDown = function() { | |
// Not that we really *need* to do anything here | |
// but just to show you it can be done: | |
array = null; | |
} | |
var results = arrayTest.runTests(); | |
document.body.appendChild(MUNIT.prettyFormat(results)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment