]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Introduce test for array destruction
authorSpencer Krum <nibz@cat.pdx.edu>
Wed, 20 Nov 2013 04:11:08 +0000 (20:11 -0800)
committerHunter Haugen <hunter@puppetlabs.com>
Thu, 31 Jul 2014 18:23:34 +0000 (11:23 -0700)
It was discovered that the concat array modifies the arrays passed to it
as an argument as a side effect. This test will ensure that doesn't
happen again.

spec/functions/concat_spec.rb

index b853b4c1ae2edb0d5d04cf216ec8220d9d3ad804..49cb2ad7f048fc234c8131c71a196295b7985ed1 100755 (executable)
@@ -27,4 +27,9 @@ describe "the concat function" do
     expect(result).to(eq(['1','2','3',['4','5'],'6']))
   end
 
+  it "should leave the original array intact" do
+    array_original = ['1','2','3']
+    result = scope.function_concat([array_original,['4','5','6']])
+    array_original.should(eq(['1','2','3']))
+  end
 end