]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(#20681) delete_at function unit test against issue
authorLeonardo Rodrigues de Mello <l@lmello.eu.org>
Mon, 16 Sep 2013 13:51:15 +0000 (10:51 -0300)
committerLeonardo Rodrigues de Mello <l@lmello.eu.org>
Tue, 17 Sep 2013 15:09:50 +0000 (12:09 -0300)
The issue #20681 describe the error of delete() function
removing the elements from the origin array/hash/string.

This issue affected the other delete functions.

The delete_at function is not afected by this bug, but
it did not had the unit test to check against it.

I had added the unit test so we could prevent regressions
on the future and also have better test coverage.

spec/unit/puppet/parser/functions/delete_at_spec.rb

index d8d9618489fc5c737e35938b2cb5507d9d1713c2..cfc0a2963a058b5a0e5f1329bc6acf37efc7dc76 100755 (executable)
@@ -16,4 +16,10 @@ describe "the delete_at function" do
     result = scope.function_delete_at([['a','b','c'],1])
     result.should(eq(['a','c']))
   end
+
+  it "should not change origin array passed as argument" do 
+    origin_array = ['a','b','c','d']
+    result = scope.function_delete_at([origin_array, 1])
+    origin_array.should(eq(['a','b','c','d']))
+  end 
 end