Skip to content

Commit

Permalink
Fix empty string compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Nov 5, 2013
1 parent 508bb2d commit eea708a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/regressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,9 @@ describe('Regressions', function() {
it("can pass through an already-compiled AST via compile/precompile", function() {
equal(Handlebars.compile(new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")]))(), 'Hello');
});

it("can pass through an empty string", function() {
equal(Handlebars.compile('')(), '');
});
}
});
1 change: 1 addition & 0 deletions src/handlebars.yy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function stripFlags(open, close) {

root
: statements EOF { return new yy.ProgramNode($1); }
| EOF { return new yy.ProgramNode([]); }
;

program
Expand Down

0 comments on commit eea708a

Please sign in to comment.