Sfoglia il codice sorgente

Update testing instructions

tags/0.5.1
Michael Jackson 14 anni fa
parent
commit
c6aef7ea12
2 ha cambiato i file con 28 aggiunte e 75 eliminazioni
  1. +28
    -13
      README.md
  2. +0
    -62
      TESTING.md

+ 28
- 13
README.md Vedi File

@@ -357,21 +357,9 @@ text and are awkward to use for markup."

Custom delimiters may not contain whitespace or the equals sign.

## Streaming

To stream template results out of mustache.js, you can pass an optional callback
to the call to `Mustache.render`:

Mustache.render(template, view, partials, function (chunk) {
print(chunk);
});

When the template is finished rendering, the callback will be called with `null`
after which it won't be called anymore for that rendering.

## Plugins for JavaScript Libraries

By default mustache.js may be used in a browser or any [CommonJS](http://www.commonjs.org/)
By default mustache.js may be used in any browser or [CommonJS](http://www.commonjs.org/)
environment, including [node](http://nodejs.org/). Additionally, mustache.js may
be built specifically for several different client libraries and platforms,
including the following:
@@ -393,6 +381,33 @@ following commands:
$ rake requirejs
$ rake qooxdoo

## Testing

The mustache.js test suite uses the [vows](http://vowsjs.org/) testing
framework. In order to run the tests you'll need to install [node](http://nodejs.org/)
first. Once it's installed, you can install vows using [npm](http://npmjs.org/).

$ npm install -g vows

Then, run the tests.

$ vows test/*_test.js

The test suite consists of both unit and integration tests. If a template isn't
rendering correctly for you, you can make a test for it by doing the following:

1. Create a template file named `mytest.mustache` in the `test/_files`
directory. Replace `mytest` with the name of your test.
2. Create a corresponding view file named `mytest.js` in the same directory.
This file should contain a JavaScript object literal enclosed in
parentheses. See any of the other view files for an example.
3. Create a file with the expected output in `mytest.txt` in the same
directory.

Then, you can run the test with:

$ TEST=mytest vows test/render_test.js

## Thanks

Mustache.js wouldn't kick ass if it weren't for these fine souls:


+ 0
- 62
TESTING.md Vedi File

@@ -1,62 +0,0 @@
## Running the mustache.js test suite

The mustache.js test suite uses the [RSpec](http://rspec.info/) testing
framework. In order to run the tests you'll need to install [Ruby](http://ruby-lang.org/)
as well as the `rake`, `rspec` (>=2), and `json` [RubyGems](http://rubygems.org/).

### How to install Ruby and the required gems from source

Make sure you have the required tools to compile it:

$ apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev

Download and extract the Ruby source, and install it:

$ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
$ tar xvzf stable-snapshot.tar.gz
$ cd ruby
$ ./configure && make && make install

Download and extract RubyGems, and install it:

$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.12.tgz
$ tar xzvf rubygems-1.8.12.tgz
$ cd rubygems-1.8.12
$ ruby setup.rb

If you want to update RubyGems:

$ gem update --system

Install the required gems:

$ gem install rake rspec json

That's it!

### How to run the tests

The mustache.js test suite currently uses 4 different JavaScript runtime engines
to maximize portability across platforms and browsers. They are:

* node
* SpiderMonkey (Mozilla, Firefox)
* JavaScriptCore (WebKit, Safari)
* Rhino (Mozilla, Java)

When the test suite runs it will automatically determine which platforms are
available on your machine and run on all of them. The suite must run on at least
one platform in order to succeed.

Once you have at least one JavaScript platform installed, you can run the test
suite with the following command:

$ rake

### How to create a test

All test files live in the spec/_files directory. To create a new test:

* Create a template file called `somename.mustache`
* Create a JavaScript file containing the view called `somename.js`
* Create a text file with the expected result called `somename.txt`

Loading…
Annulla
Salva