diff options
author | Rob Fugina <rfugina@genome.wustl.edu> | 2014-11-18 12:34:55 -0600 |
---|---|---|
committer | Rob Fugina <rfugina@genome.wustl.edu> | 2014-12-17 12:55:48 -0600 |
commit | 2a3babc348895a4c8990d57f003c41e50f3ed932 (patch) | |
tree | ddb8cd723a0073c4552171212f9f6ed57e121990 /spec | |
parent | 72ee9b5b68f04c46f80238c85886f99af7ca2623 (diff) | |
download | puppet-stdlib-2a3babc348895a4c8990d57f003c41e50f3ed932.tar.gz puppet-stdlib-2a3babc348895a4c8990d57f003c41e50f3ed932.tar.bz2 |
Added type checks for dirname(), and additional tests
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/functions/dirname_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/functions/dirname_spec.rb b/spec/functions/dirname_spec.rb index 8a3bcab..4261144 100755 --- a/spec/functions/dirname_spec.rb +++ b/spec/functions/dirname_spec.rb @@ -12,6 +12,10 @@ describe "the dirname function" do expect { scope.function_dirname([]) }.to( raise_error(Puppet::ParseError)) end + it "should raise a ParseError if there is more than 1 argument" do + expect { scope.function_dirname(['a', 'b']) }.to( raise_error(Puppet::ParseError)) + end + it "should return dirname for an absolute path" do result = scope.function_dirname(['/path/to/a/file.ext']) expect(result).to(eq('/path/to/a')) @@ -21,4 +25,14 @@ describe "the dirname function" do result = scope.function_dirname(['path/to/a/file.ext']) expect(result).to(eq('path/to/a')) end + + it "should complain about hash argument" do + expect { scope.function_dirname([{}]) }.to( raise_error(Puppet::ParseError)) + end + it "should complain about list argument" do + expect { scope.function_dirname([[]]) }.to( raise_error(Puppet::ParseError)) + end + it "should complain about numeric argument" do + expect { scope.function_dirname([2112]) }.to( raise_error(Puppet::ParseError)) + end end |