massimiliano-mantione/metascript — pull request #19 by drslump (2014-05-30 18:32:29+00:00)
Title: Skeleton for functional tests

Not much at the moment but I think this covers two very helpful scenarios:

- Creating new tests becomes trivial, just create a `.mjs` file in the `test/functional` directory
- They are basically code snippets so they also serve as documentation

Specific tests can be run using a regular expression, ie: `mocha -R spec -g 'functional if' test`. If the shell environment variable `VERBOSE` is set to something and the test fails after it's been compiled into javascript, the generated code will be also printed, so it becomes very easy to debug code generation too.

Note that I introduced the `#doc` macro in the common library, please feel free to modify it or suggest an alternative approach. Since unassigned string literals get removed from the AST I had to introduce the macro, but it would be even nicer if it wasn't required.

I also refactored the `build-tests.js` to run as part of the pre-test task, previously it was modelled as a test suite, which forced to run the test twice to actually see any changes applied.