Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

JavaScript unit tests.

tree: 84a375d125

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore first commit October 17, 2009
Octocat-spinner-32 README.textile
Octocat-spinner-32 riot.js
Octocat-spinner-32 riotjs.html Added assert... raises October 18, 2009
Octocat-spinner-32 test.js
README.textile

This is a JavaScript implementation of Riot

It will run in a browser or in Rhino.

The tests look like this:

Riot.run(function() {
  context('basic riot functionality', function() {
    given('some simple equality tests', function() {
      asserts('a simple truth test should return true', true).isTrue();
      asserts('isNull is null', null).isNull();
    });

    given('another context', function() {
      asserts('equals should compare strings as expected', 'test string').equals('test string');
    });

    given('a context concerned with functions', function() {
      asserts('asserts() should allow functions to be compared', function() {
        return 'test string';
      }).equals('test string');
    });
  });

  given('yet another context', function() {
    asserts('equals should compare strings as expected', 'test string').equals('test string');
  });
});

Assertions

  • equals – for example, asserts('description').equals('value')
  • isNull
  • isTrue
  • typeOf
  • raises

Riot.run

Riot.run(function() { // your tests }); just adds your tests to window.onload. If there’s already an onload handler it’ll prepend it. If there’s no window it will just run the tests.

Todo

  • Add formatter for xpcomcore
  • Ask g-man about actual() — I defer execution to transparently match functions/values, but does this make sense?
  • Extract the assertions into their own property list so adding user-defined ones is cleaner
  • If you don’t give a damn then we don’t give a fuck
Something went wrong with that request. Please try again.