Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ixth authored and vecmezoni committed Nov 5, 2016
1 parent b65c8bd commit 4d20482
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/compiler.js
Expand Up @@ -1626,6 +1626,33 @@
finish(done);
});

it('should control expression whitespaces correctly', function(done) {
equal(
'Well, {{- \' hello, \' -}} my friend',
'Well, hello, my friend'
);

equal(' {{ 2 + 2 }} ', ' 4 ');

equal(' {{-2 + 2 }} ', '4 ');

equal(' {{ -2 + 2 }} ', ' 0 ');

equal(' {{ 2 + 2 -}} ', ' 4');

render(
' {{ 2 + 2- }}',
{},
{ noThrow: true },
function(err, res) {
expect(res).to.be(undefined);
expect(err).to.match(/unexpected token: }}/);
}
);

finish(done);
});

it('should get right value when macro parameter conflict with global macro name', function(done) {
render(
'{# macro1 and macro2 definition #}' +
Expand Down

0 comments on commit 4d20482

Please sign in to comment.