summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet/parser')
-rw-r--r--spec/unit/puppet/parser/functions/delete_undef_values_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/puppet/parser/functions/delete_undef_values_spec.rb b/spec/unit/puppet/parser/functions/delete_undef_values_spec.rb
index 0536641..404aeda 100644
--- a/spec/unit/puppet/parser/functions/delete_undef_values_spec.rb
+++ b/spec/unit/puppet/parser/functions/delete_undef_values_spec.rb
@@ -26,4 +26,16 @@ describe "the delete_undef_values function" do
result = scope.function_delete_undef_values([{'a'=>'A','b'=>:undef,'c'=>'C','d'=>'undef'}])
result.should(eq({'a'=>'A','c'=>'C','d'=>'undef'}))
end
+
+ it "should not change origin array passed as argument" do
+ origin_array = ['a',:undef,'c','undef']
+ result = scope.function_delete_undef_values([origin_array])
+ origin_array.should(eq(['a',:undef,'c','undef']))
+ end
+
+ it "should not change origin hash passed as argument" do
+ origin_hash = { 'a' => 1, 'b' => :undef, 'c' => 'undef' }
+ result = scope.function_delete_undef_values([origin_hash])
+ origin_hash.should(eq({ 'a' => 1, 'b' => :undef, 'c' => 'undef' }))
+ end
end