summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/ast/astarray.rb3
-rwxr-xr-xspec/unit/parser/ast/astarray.rb4
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb
index 0fccbca75..8f09aa922 100644
--- a/lib/puppet/parser/ast/astarray.rb
+++ b/lib/puppet/parser/ast/astarray.rb
@@ -30,9 +30,10 @@ class Puppet::Parser::AST
items << child
end
}
+
rets = items.flatten.collect { |child|
child.safeevaluate(scope)
- }.flatten
+ }
return rets.reject { |o| o.nil? }
end
diff --git a/spec/unit/parser/ast/astarray.rb b/spec/unit/parser/ast/astarray.rb
index f1c28ce47..b3026fe1e 100755
--- a/spec/unit/parser/ast/astarray.rb
+++ b/spec/unit/parser/ast/astarray.rb
@@ -49,7 +49,7 @@ describe Puppet::Parser::AST::ASTArray do
operator.evaluate(@scope).should == [123]
end
- it "should flatten the results of children evaluation" do
+ it "should not flatten the results of children evaluation" do
item1 = stub "item1", :is_a? => true
item2 = stub "item2"
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
@@ -59,7 +59,7 @@ describe Puppet::Parser::AST::ASTArray do
item1.expects(:safeevaluate).with(@scope).returns([123])
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
- operator.evaluate(@scope).should == [123]
+ operator.evaluate(@scope).should == [[123]]
end