File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
lib/puppet/parser/functions
spec/unit/puppet/parser/functions Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ module Puppet::Parser::Functions
2222 accumulator = Hash . new
2323 # Merge into the accumulator hash
2424 args . each do |arg |
25+ next if arg . is_a? String and arg . empty? # empty string is synonym for puppet's undef
2526 unless arg . is_a? ( Hash )
2627 raise Puppet ::ParseError , "merge: unexpected argument type #{ arg . class } , only expects hash arguments"
2728 end
Original file line number Diff line number Diff line change 2626 describe 'when calling merge on the scope instance' do
2727 it 'should require all parameters are hashes' do
2828 expect { new_hash = scope . function_merge ( [ { } , '2' ] ) } . to raise_error ( Puppet ::ParseError , /unexpected argument type String/ )
29+ expect { new_hash = scope . function_merge ( [ { } , 2 ] ) } . to raise_error ( Puppet ::ParseError , /unexpected argument type Fixnum/ )
30+ end
31+
32+ it 'should accept empty strings as puppet undef' do
33+ expect { new_hash = scope . function_merge ( [ { } , '' ] ) } . not_to raise_error ( Puppet ::ParseError , /unexpected argument type String/ )
2934 end
3035
3136 it 'should be able to merge two hashes' do
You can’t perform that action at this time.
0 commit comments