Add some tests that wouldn't have passed before
Merge pull request #962 from ForbesLindesay/fix/js-expression-parsing

Use character-parser for js-expression parsing
Escape JavaScript strings as late as possible

By doing all our escaping in one place at the last possible opportunity,
all the values are properly esacped in `buffer` and we never have to do
the bizzare un-escaping or double-escaping.  This should prove itself to
be vastly more robust.
Add test case for #830 #847
Fix expression buffering bug