Merge pull request #306 from hunner/fix_concat
(MODULES-1195) Rebase of #202
This commit is contained in:
commit
e310b1fdab
2 changed files with 6 additions and 5 deletions
|
@ -28,11 +28,7 @@ Would result in:
|
|||
raise(Puppet::ParseError, 'concat(): Requires array to work with')
|
||||
end
|
||||
|
||||
if b.is_a?(Array)
|
||||
result = a.concat(b)
|
||||
else
|
||||
result = a << b
|
||||
end
|
||||
result = a + Array(b)
|
||||
|
||||
return result
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue