From 53a2bea4ddad0a9f0d537fd8833a437ed2376889 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Tue, 28 Sep 2010 11:50:56 -0700 Subject: Fix for #4804 -- escaped backslashes in interpolated strings Part of the ongoing refinement / cleanup of the string interpolation semantics. When scanning for an unescaped string terminator we now also allow an 0 or more pairs of backslashes (that is, escaped backslashes) before the terminator. Thanks to Jacob for the test I should have added. --- spec/unit/parser/lexer_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index b27980bf2..2d67bf357 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -30,6 +30,14 @@ describe Puppet::Parser::Lexer do @lexer.line.should == 10 end + + it "should not think the terminator is escaped, when preceeded by an even number of backslashes" do + @lexer.line = 10 + @lexer.string = "here\nis\nthe\nstring\\\\'with\nextra\njunk" + @lexer.slurpstring("'") + + @lexer.line.should == 13 + end end end -- cgit