Few more tests.
This commit is contained in:
parent
c7c8647634
commit
1abf4b62fc
6 changed files with 31 additions and 1 deletions
|
@ -8,7 +8,7 @@ module Puppet::Parser::Functions
|
|||
) do |arguments|
|
||||
|
||||
if (arguments.size != 1) then
|
||||
raise(Puppet::ParseError, "is_valid_netmask(): Wrong number of arguments "+
|
||||
raise(Puppet::ParseError, "date(): Wrong number of arguments "+
|
||||
"given #{arguments.size} for 1")
|
||||
end
|
||||
|
||||
|
|
|
@ -18,4 +18,14 @@ describe "the bool2num function" do
|
|||
lambda { @scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError))
|
||||
end
|
||||
|
||||
it "should convert true to 1" do
|
||||
result = @scope.function_bool2num([true])
|
||||
result.should(eq(1))
|
||||
end
|
||||
|
||||
it "should convert false to 0" do
|
||||
result = @scope.function_bool2num([false])
|
||||
result.should(eq(0))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,4 +18,9 @@ describe "the capitalize function" do
|
|||
lambda { @scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError))
|
||||
end
|
||||
|
||||
it "should capitalize the beginning of a string" do
|
||||
result = @scope.function_capitalize(["abc"])
|
||||
result.should(eq("Abc"))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,4 +18,9 @@ describe "the chomp function" do
|
|||
lambda { @scope.function_chomp([]) }.should( raise_error(Puppet::ParseError))
|
||||
end
|
||||
|
||||
it "should chomp the end of a string" do
|
||||
result = @scope.function_chomp(["abc\n"])
|
||||
result.should(eq("abc"))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,4 +18,9 @@ describe "the chop function" do
|
|||
lambda { @scope.function_chop([]) }.should( raise_error(Puppet::ParseError))
|
||||
end
|
||||
|
||||
it "should chop the end of a string" do
|
||||
result = @scope.function_chop(["asdf\n"])
|
||||
result.should(eq("asdf"))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,4 +18,9 @@ describe "the count function" do
|
|||
lambda { @scope.function_count([]) }.should( raise_error(Puppet::ParseError))
|
||||
end
|
||||
|
||||
it "should return the size of an array" do
|
||||
result = @scope.function_count([['a','c','b']])
|
||||
result.should(eq(3))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue