Browse files

Mocha is now a full-fleged scripting environment. Renamed moc to moch…

…a, added support for reading stdin. Moved print() from the interpreter to the runtime.
  • Loading branch information...
logancollins committed Aug 8, 2012
1 parent 1d696a2 commit bd0ca4f4a7a6312b9d1b73b943f0f7158227e7c5
Showing with 18 additions and 0 deletions.
  1. +18 −0 README.mdown
@@ -308,11 +308,29 @@ Mocha exceptions that do not originate from within the JavaScript environment ca
`mocha` is the command-line interpreter for Mocha. It has two modes: script and interactive. Its scripting mode is similar to `python` and `ruby`. Its interactive mode is similar to `python`, `irb`, and `jsc`.
+### Interactive
Interactive mode adds the following set of built-in functions:
- `exit()` – Exits the interpreter
- `gc()` – Instructs the JavaScript garbage collector to perform a collection
- `checkSyntax(string)` – Validates the syntax of `string`, returning a `Boolean`
+### Scripting
+You can use `mocha` the same way you use other scripting envorinments. Add a shebang declaration to the top of a script to enable its use on the command line, like so:
+### Example
+var d = {};
+d['foo'] = 'bar';
+d['baz'] = 1.0;
+d['bin'] = ['foo', 'bar', 'baz'];
## Using Mocha with OS X

0 comments on commit bd0ca4f

Please sign in to comment.