summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-09-28 11:50:56 -0700
committerMarkus Roberts <Markus@reality.com>2010-09-28 19:42:06 -0700
commit53a2bea4ddad0a9f0d537fd8833a437ed2376889 (patch)
treeea4e3973c32120fa753eb984a964e7f961c162b1 /spec
parentd12e477326a645f75cc58cc0ad7e4fd3ec7eee23 (diff)
downloadpuppet-53a2bea4ddad0a9f0d537fd8833a437ed2376889.tar.gz
puppet-53a2bea4ddad0a9f0d537fd8833a437ed2376889.tar.xz
puppet-53a2bea4ddad0a9f0d537fd8833a437ed2376889.zip
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.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/parser/lexer_spec.rb8
1 files changed, 8 insertions, 0 deletions
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