Inline unit tests in javascript
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo
lib
LICENSE
README.md
demo.html
index.html
inline.js

README.md

Inline.js - Inline Testing in Javascript

Inline.js allows you to append unit tests onto function declarations inline in code, such as:

 var square = function(n) { return n * n; }.where(3).shouldEqual(9);

It was inspired by the article Extending JavaScript with inline unit tests by Sergi Mansilla, which uses macros to achieve a similar result.

Inline.js is only a quick experiment, and I wouldn’t really recommend mixing tests and code, but I do think there’s something interesting about inline testing, and could see it being used for teaching or demonstration purposes. Read more on my blog.