summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorUwe Stuehler <ustuehler@team.mobile.de>2012-10-23 16:43:03 +0200
committerAdrien Thebo <git@somethingsinistral.net>2013-03-18 15:07:13 -0700
commit5a11279cc54e7f9f5d168c75728f990d0bd0b694 (patch)
tree9ea343c93dcf8aaf283739cb3004f5826427ddcb /spec/unit
parent96e19d05f3b07a12a3a965e7d2ec90cacf25cccc (diff)
downloadpuppet-stdlib-5a11279cc54e7f9f5d168c75728f990d0bd0b694.tar.gz
puppet-stdlib-5a11279cc54e7f9f5d168c75728f990d0bd0b694.tar.bz2
Fix number of arguments check in flatten()
The function only uses the first argument, so raise an error with too few arguments *and* with too many arguments.
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/puppet/parser/functions/flatten_spec.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/unit/puppet/parser/functions/flatten_spec.rb b/spec/unit/puppet/parser/functions/flatten_spec.rb
index d4dfd20..dba7a6b 100755
--- a/spec/unit/puppet/parser/functions/flatten_spec.rb
+++ b/spec/unit/puppet/parser/functions/flatten_spec.rb
@@ -11,6 +11,10 @@ describe "the flatten function" do
lambda { scope.function_flatten([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should raise a ParseError if there is more than 1 argument" do
+ lambda { scope.function_flatten([[], []]) }.should( raise_error(Puppet::ParseError))
+ end
+
it "should flatten a complex data structure" do
result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]])
result.should(eq(["a","b","c","d","e","f","g"]))