Skip to content

Commit b43c044

Browse files
committed
(#20681) delete_at function unit test against issue
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.
1 parent 8064302 commit b43c044

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@
1616
result = scope.function_delete_at([['a','b','c'],1])
1717
result.should(eq(['a','c']))
1818
end
19+
20+
it "should not change origin array passed as argument" do
21+
origin_array = ['a','b','c','d']
22+
result = scope.function_delete_at([origin_array, 1])
23+
origin_array.should(eq(['a','b','c','d']))
24+
end
1925
end

0 commit comments

Comments
 (0)