diff options
| author | Matt Robinson <matt@puppetlabs.com> | 2010-07-26 19:34:27 -0700 |
|---|---|---|
| committer | markus <markus@AVA-351181.(none)> | 2010-08-03 15:19:42 -0700 |
| commit | be2b1f360fc15596098280265e6aa76e8043eb92 (patch) | |
| tree | e1102cd9fabc6fc089825d5b76f57407575d0a71 /spec/unit/parser/ast | |
| parent | 03808fdc05c4660c1559cf8a09be80664096e0ad (diff) | |
| download | puppet-be2b1f360fc15596098280265e6aa76e8043eb92.tar.gz puppet-be2b1f360fc15596098280265e6aa76e8043eb92.tar.xz puppet-be2b1f360fc15596098280265e6aa76e8043eb92.zip | |
[#4370] Fixes extlookup precedence getting overwritten between runs
We found the gsub! in extlookup was actually modifying the value for
extlookup_precedence, so the next node to call it just got the
interpolated value from the first run.
We did two things in the code to prevent this:
1. We returned a dup of the ast string object so that modifying it
wouldn’t change puppet’s state. We didn’t do this for all possible
return values because we depend on using the original ast array object
to do array concatenation
2. We fixed extlookup to not do a destructive gsub
Reviewed by: Jesse Wolfe
Diffstat (limited to 'spec/unit/parser/ast')
| -rwxr-xr-x | spec/unit/parser/ast/leaf_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index 5bdca67fa..eb71f0d37 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -47,6 +47,10 @@ describe Puppet::Parser::AST::String do value = stub 'value', :is_a? => true, :to_s => "ab" Puppet::Parser::AST::String.new( :value => value ).to_s.should == "\"ab\"" end + it "should return a dup of its value" do + value = "" + Puppet::Parser::AST::String.new( :value => value ).evaluate(stub 'scope').should_not be_equal(value) + end end end |
