Using with MozRepl and Emacs
The following needs devel branch of MozUnit.
If you’re using MozUnit along with MozRepl and Emacs, you can have a very tight write/test cycle.
- Create a test case in a buffer and save it to a file. The file should look like:
Components.utils.import('resource://mozunit/test_case.jsm');
Components.utils.import('resource://mozunit/assertions.jsm');
var tc = new TestCase();
tc.tests = {
'two plus two is four': function() {
assert.equals(4, 2+3);
}
};
tc.run({ onResult: function(report) { repl.print(report) } });
- Start MozRepl
- While you are in the buffer with tests, press
C-c C-lto load it in MozRepl. - That’s it. Tests get executed and output written to MozRepl.
