From 1d9189d860f28067b72093cbe4027cf49b7d612c Mon Sep 17 00:00:00 2001 From: Jetroid Date: Mon, 24 Aug 2015 12:01:29 +0100 Subject: (MODULE-2456) Modify union to accept more than two arrays Add spec tests to test the new functionality: *Case for 3 arrays. *Case for 4 arrays. Modify README to note new functionality. This is for issue MODULE-2456, follow the precedent of MODULE-444. This change allows union to be much more useful, unioning many arrays in one line rather than in n lines. Additionally, as this is only added functionality, and does not affect the 2 array case that all modules currently using array are using, it should not affect any existing modules utilizing union. This is now useful, for example, for merging many arrays of resources (eg: packages.) to generate just one list with no duplicates, to avoid duplicate resource declarations. --- spec/acceptance/union_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'spec/acceptance/union_spec.rb') diff --git a/spec/acceptance/union_spec.rb b/spec/acceptance/union_spec.rb index 6db8d0c..160fd7b 100755 --- a/spec/acceptance/union_spec.rb +++ b/spec/acceptance/union_spec.rb @@ -6,9 +6,10 @@ describe 'union function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('opera it 'unions arrays' do pp = <<-EOS $a = ["the","public"] - $b = ["art","galleries"] + $b = ["art"] + $c = ["galleries"] # Anagram: Large picture halls, I bet - $o = union($a,$b) + $o = union($a,$b,$c) notice(inline_template('union is <%= @o.inspect %>')) EOS -- cgit v1.2.3