Skip to content

Commit

Permalink
Add test for handlebars-lang#1284
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Dec 20, 2016
1 parent ad3037c commit 5bbb54e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ describe('compiler', function() {
}, Error, 'You must pass a string or Handlebars AST to Handlebars.compile. You passed [object Object]');
});

it('should include the location in the error (row and column)', function() {
try {
Handlebars.compile(' \n {{#if}}\n{{/def}}')();
equal(true, false, 'Statement must throw exception. This line should not be executed.');
} catch (err) {
equal(err.column, 5, 'Checking error column');
equal(err.lineNumber, 2, 'Checking error row');
}
});

it('can utilize AST instance', function() {
equal(Handlebars.compile({
type: 'Program',
Expand Down

0 comments on commit 5bbb54e

Please sign in to comment.