summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-10-02 01:14:03 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-10-02 01:14:17 -0700
commitce9a6f97ab1784d8bd60eae8b60272c9875b1f84 (patch)
treeba2e2fe2d56b813e93133683bab006abf28d6cc5 /spec/unit/parser
parentc6e824ad5144957e351892a1d745a127b02f34b3 (diff)
parent8cd1540f82cbdf903c164bdbc2c7229e34a4178b (diff)
downloadpuppet-ce9a6f97ab1784d8bd60eae8b60272c9875b1f84.tar.gz
puppet-ce9a6f97ab1784d8bd60eae8b60272c9875b1f84.tar.xz
puppet-ce9a6f97ab1784d8bd60eae8b60272c9875b1f84.zip
Partial merge to 2.6.2rc1 : Merge commit '8cd1540' into next
There are merge conflicts with commits following this one.
Diffstat (limited to 'spec/unit/parser')
-rw-r--r--spec/unit/parser/ast/function_spec.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/unit/parser/ast/function_spec.rb b/spec/unit/parser/ast/function_spec.rb
index c57c7f098..38e344157 100644
--- a/spec/unit/parser/ast/function_spec.rb
+++ b/spec/unit/parser/ast/function_spec.rb
@@ -61,20 +61,30 @@ describe Puppet::Parser::AST::Function do
end
it "should call the underlying ruby function" do
- argument = stub 'arg', :safeevaluate => "nothing"
+ argument = stub 'arg', :safeevaluate => ["nothing"]
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
- @scope.expects(:function_exist).with("nothing")
+ @scope.expects(:function_exist).with(["nothing"])
+
+ func.evaluate(@scope)
+ end
+
+ it "should convert :undef to '' in arguments" do
+ argument = stub 'arg', :safeevaluate => ["foo", :undef, "bar"]
+ Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
+ func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
+
+ @scope.expects(:function_exist).with(["foo", "", "bar"])
func.evaluate(@scope)
end
it "should return the ruby function return for rvalue functions" do
- argument = stub 'arg', :safeevaluate => "nothing"
+ argument = stub 'arg', :safeevaluate => ["nothing"]
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
- @scope.stubs(:function_exist).with("nothing").returns("returning")
+ @scope.stubs(:function_exist).with(["nothing"]).returns("returning")
func.evaluate(@scope).should == "returning"
end