summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/parser/functions/type_spec.rb22
-rw-r--r--spec/unit/parser/functions/unique_spec.rb9
-rw-r--r--spec/unit/parser/functions/values_spec.rb4
3 files changed, 27 insertions, 8 deletions
diff --git a/spec/unit/parser/functions/type_spec.rb b/spec/unit/parser/functions/type_spec.rb
index 36c3823..53071f3 100644
--- a/spec/unit/parser/functions/type_spec.rb
+++ b/spec/unit/parser/functions/type_spec.rb
@@ -18,19 +18,29 @@ describe "the type function" do
lambda { @scope.function_type([]) }.should( raise_error(Puppet::ParseError))
end
- it "should return String when given a string" do
+ it "should return string when given a string" do
result = @scope.function_type(["aaabbbbcccc"])
- result.should(eq('String'))
+ result.should(eq('string'))
end
- it "should return Array when given an array" do
+ it "should return array when given an array" do
result = @scope.function_type([["aaabbbbcccc","asdf"]])
- result.should(eq('Array'))
+ result.should(eq('array'))
end
- it "should return Hash when given a hash" do
+ it "should return hash when given a hash" do
result = @scope.function_type([{"a"=>1,"b"=>2}])
- result.should(eq('Hash'))
+ result.should(eq('hash'))
+ end
+
+ it "should return integer when given an integer" do
+ result = @scope.function_type(["1"])
+ result.should(eq('integer'))
+ end
+
+ it "should return float when given a float" do
+ result = @scope.function_type(["1.34"])
+ result.should(eq('float'))
end
end
diff --git a/spec/unit/parser/functions/unique_spec.rb b/spec/unit/parser/functions/unique_spec.rb
index 7b8b08d..627dc33 100644
--- a/spec/unit/parser/functions/unique_spec.rb
+++ b/spec/unit/parser/functions/unique_spec.rb
@@ -19,8 +19,13 @@ describe "the unique function" do
end
it "should remove duplicate elements in a string" do
- result = @scope.function_squeeze([["aabbc"]])
- result.should(eq(['abc']))
+ result = @scope.function_unique(["aabbc"])
+ result.should(eq('abc'))
+ end
+
+ it "should remove duplicate elements in an array" do
+ result = @scope.function_unique([["a","a","b","b","c"]])
+ result.should(eq(['a','b','c']))
end
end
diff --git a/spec/unit/parser/functions/values_spec.rb b/spec/unit/parser/functions/values_spec.rb
index 92f1311..f6eb5b6 100644
--- a/spec/unit/parser/functions/values_spec.rb
+++ b/spec/unit/parser/functions/values_spec.rb
@@ -23,4 +23,8 @@ describe "the values function" do
result.should(eq(['1','2','3']))
end
+ it "should return values from a hash" do
+ lambda { @scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError))
+ end
+
end