Skip to content

Using with MozRepl and Emacs

bard edited this page Sep 13, 2010 · 4 revisions

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.

  1. 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) } });

  1. Start MozRepl
  2. While you are in the buffer with tests, press C-c C-l to load it in MozRepl.
  3. That’s it. Tests get executed and output written to MozRepl.

Clone this wiki locally