diff options
author | kpdecker <kpdecker@gmail.com> | 2014-11-28 17:26:52 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-11-28 17:26:52 -0600 |
commit | 8a6796e5c09686b47945a35826d77680d589d07c (patch) | |
tree | 9cb768c41e6c3b3b39f9bcd5072ea9f472d3c1c6 /spec/parser.js | |
parent | 95b23095c097447ff4e1059720abfd2132cb9b2d (diff) | |
download | handlebars.js-8a6796e5c09686b47945a35826d77680d589d07c.zip handlebars.js-8a6796e5c09686b47945a35826d77680d589d07c.tar.gz handlebars.js-8a6796e5c09686b47945a35826d77680d589d07c.tar.bz2 |
Move Jison parsing out of AST into helpers
Diffstat (limited to 'spec/parser.js')
-rw-r--r-- | spec/parser.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/parser.js b/spec/parser.js index ad52734..26eb4dd 100644 --- a/spec/parser.js +++ b/spec/parser.js @@ -166,7 +166,6 @@ describe('parser', function() { it('parses inverse block with block params', function() { equals(ast_for("{{^foo as |bar baz|}}content{{/foo}}"), "BLOCK:\n PATH:foo []\n {{^}}\n BLOCK PARAMS: [ bar baz ]\n CONTENT[ 'content' ]\n"); }); - it("raises if there's a Parse error", function() { shouldThrow(function() { ast_for("foo{{^}}bar"); @@ -186,6 +185,18 @@ describe('parser', function() { }, Error, /goodbyes doesn't match hellos/); }); + it('should handle invalid paths', function() { + shouldThrow(function() { + ast_for("{{foo/../bar}}"); + }, Error, /Invalid path: foo\/\.\. - 1:2/); + shouldThrow(function() { + ast_for("{{foo/./bar}}"); + }, Error, /Invalid path: foo\/\. - 1:2/); + shouldThrow(function() { + ast_for("{{foo/this/bar}}"); + }, Error, /Invalid path: foo\/this - 1:2/); + }); + it('knows how to report the correct line number in errors', function() { shouldThrow(function() { ast_for("hello\nmy\n{{foo}"); |