4 describe "the unique function" do
6 Puppet::Parser::Functions.autoloader.loadall
10 @scope = Puppet::Parser::Scope.new
14 Puppet::Parser::Functions.function("unique").should == "function_unique"
17 it "should raise a ParseError if there is less than 1 arguments" do
18 lambda { @scope.function_unique([]) }.should( raise_error(Puppet::ParseError))
21 it "should remove duplicate elements in a string" do
22 result = @scope.function_unique(["aabbc"])
23 result.should(eq('abc'))
26 it "should remove duplicate elements in an array" do
27 result = @scope.function_unique([["a","a","b","b","c"]])
28 result.should(eq(['a','b','c']))