summaryrefslogtreecommitdiff
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorKen Barber <ken@bob.sh>2011-07-29 20:11:47 +0100
committerKen Barber <ken@bob.sh>2011-07-29 20:11:47 +0100
commit18e5302614bce168ac07e35dc23b058064e9e41c (patch)
treeb45471bdb3846efa835ed394dd1e891620b86e54 /spec/unit/parser
parent56a402e6542105ec63c5071e685d5af93fd4d0f3 (diff)
downloadpuppet-stdlib-18e5302614bce168ac07e35dc23b058064e9e41c.tar.gz
puppet-stdlib-18e5302614bce168ac07e35dc23b058064e9e41c.tar.bz2
(#2) fix is_string finally so it also makes sure numbers return false.
Diffstat (limited to 'spec/unit/parser')
-rw-r--r--spec/unit/parser/functions/is_string_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/parser/functions/is_string_spec.rb b/spec/unit/parser/functions/is_string_spec.rb
index 8c0061e..4f3f5fd 100644
--- a/spec/unit/parser/functions/is_string_spec.rb
+++ b/spec/unit/parser/functions/is_string_spec.rb
@@ -18,4 +18,24 @@ describe "the is_string function" do
lambda { @scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should return true if a string" do
+ result = @scope.function_is_string(["asdf"])
+ result.should(eq(true))
+ end
+
+ it "should return false if an integer" do
+ result = @scope.function_is_string(["3"])
+ result.should(eq(false))
+ end
+
+ it "should return false if a float" do
+ result = @scope.function_is_string(["3.23"])
+ result.should(eq(false))
+ end
+
+ it "should return false if an array" do
+ result = @scope.function_is_string([["a","b","c"]])
+ result.should(eq(false))
+ end
+
end