From 88ec36afe55ca5492b5ff22ac806f995dd225213 Mon Sep 17 00:00:00 2001 From: Ben Cherry Date: Fri, 3 Dec 2010 14:01:30 -0800 Subject: [PATCH] added test descriptions and instructions to the readme --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 22af4d9..a6ace7d 100644 --- a/README.md +++ b/README.md @@ -344,8 +344,32 @@ directory. Run `rake commonjs` to get a CommonJS compatible plugin file in the `mustache-commonjs/` directory which you can also use with [Node.js][]. +## Testing + +To run the mustache.js test suite, run `rake spec`. All specs will be run first with JavaScriptCore (using `jsc`) +and again with Rhino, using `java org.mozilla.javascript.tools.shell.Main`. To install Rhino on OSX, follow [these instructions](Rhino Install). + +### Adding Tests + +Tests are located in the `examples/` directory. Adding a new test requires three files. Here's an example to add a test named "foo": + +`examples/foo.html` (the template): + + foo {{bar}} + +`examples/foo.js` (the view context): + + var foo = { + bar: "baz" + }; + +`examples/foo.txt` (the expected output): + + foo baz + [jQuery]: http://jquery.com/ [Dojo]: http://www.dojotoolkit.org/ [Yui]: http://developer.yahoo.com/yui/ [CommonJS]: http://www.commonjs.org/ [Node.js]: http://nodejs.org/ +[Rhino Install]: http://michaux.ca/articles/installing-rhino-on-os-x