From 5bbb54e636719bbbefc534f012a4f3a764298dab Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 20 Dec 2016 09:32:18 +0100 Subject: [PATCH] Add test for #1284 --- spec/compiler.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/compiler.js b/spec/compiler.js index be1fb007d..fde0f3124 100644 --- a/spec/compiler.js +++ b/spec/compiler.js @@ -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',