[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:15 UTC 2009


The following commit has been merged in the master branch:
commit 614326afdbe542c9d4c480df43631c1f3cfc394a
Author: Luke Kanies <luke at madstop.com>
Date:   Fri Oct 3 18:30:52 2008 -0500

    Fixing #1098 - Multiline strings now correctly increment the line count
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/CHANGELOG b/CHANGELOG
index 2b0e808..3f0c963 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,8 @@
     
     Fixing #1089 - Log messages are now tagged with the log level,
     making it easier to match messages in the 'tagmail' report.
+    
+    Fixing #1098 - Multiline strings now correctly increment the line count
 
     Fixing #1614 - Environments no longer have to be listed out
 
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 5dd036e..9226434 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -438,6 +438,9 @@ class Puppet::Parser::Lexer
             str.gsub!(/\\#{quote}/,quote)
         end
 
+        # Add to our line count for every carriage return in multi-line strings.
+        @line += str.count("\n")
+
         return str
     end
 
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb
index c35a81a..3b0df96 100755
--- a/spec/unit/parser/lexer.rb
+++ b/spec/unit/parser/lexer.rb
@@ -4,6 +4,27 @@ require File.dirname(__FILE__) + '/../../spec_helper'
 
 require 'puppet/parser/lexer'
 
+describe Puppet::Parser::Lexer do
+    describe "when reading strings" do
+        before { @lexer = Puppet::Parser::Lexer.new }
+        it "should increment the line count for every carriage return in the string" do
+            @lexer.line = 10
+            @lexer.string = "this\nis\natest'"
+            @lexer.slurpstring("'")
+
+            @lexer.line.should == 12
+        end
+
+        it "should not increment the line count for escapes in the string" do
+            @lexer.line = 10
+            @lexer.string = "this\\nis\\natest'"
+            @lexer.slurpstring("'")
+
+            @lexer.line.should == 10
+        end
+    end
+end
+
 describe Puppet::Parser::Lexer::Token do
     before do
         @token = Puppet::Parser::Lexer::Token.new(%r{something}, :NAME)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list