diff options
Diffstat (limited to 'spec/regressions.js')
-rw-r--r-- | spec/regressions.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/spec/regressions.js b/spec/regressions.js index eec5a49..7412cd3 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -1,4 +1,4 @@ -/*global CompilerContext, shouldCompileTo */ +/*global CompilerContext, Handlebars, shouldCompileTo, shouldThrow */ describe('Regressions', function() { it("GH-94: Cannot read property of undefined", function() { var data = {"books":[{"title":"The origin of species","author":{"name":"Charles Darwin"}},{"title":"Lazarillo de Tormes"}]}; @@ -85,12 +85,19 @@ describe('Regressions', function() { }); it('GH-437: Matching escaping', function() { - (function() { + shouldThrow(function() { CompilerContext.compile('{{{a}}'); - }).should.throw(Error); - (function() { + }, Error); + shouldThrow(function() { CompilerContext.compile('{{a}}}'); - }).should.throw(Error); + }, Error); + }); + + it("GH-676: Using array in escaping mustache fails", function() { + var string = "{{arr}}"; + var data = { "arr": [1,2] }; + + shouldCompileTo(string, data, data.arr.toString(), "it works as expected"); }); it("Mustache man page", function() { @@ -106,9 +113,9 @@ describe('Regressions', function() { }); it("Passing falsy values to Handlebars.compile throws an error", function() { - (function() { + shouldThrow(function() { CompilerContext.compile(null); - }).should.throw("You must pass a string or Handlebars AST to Handlebars.precompile. You passed null"); + }, Error, 'You must pass a string or Handlebars AST to Handlebars.precompile. You passed null'); }); if (Handlebars.AST) { |