Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / concat_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'concat function' do
4   describe 'success' do
5     pp1 = <<-DOC
6       $output = concat(['1','2','3'],['4','5','6'])
7       validate_array($output)
8       if size($output) != 6 {
9         fail("${output} should have 6 elements.")
10       }
11     DOC
12     it 'concats one array to another' do
13       apply_manifest(pp1, :catch_failures => true)
14     end
15
16     pp2 = <<-DOC
17       $output = concat(['1','2','3'],'4','5','6',['7','8','9'])
18       validate_array($output)
19       if size($output) != 9 {
20         fail("${output} should have 9 elements.")
21       }
22     DOC
23     it 'concats arrays and primitives to array' do
24       apply_manifest(pp2, :catch_failures => true)
25     end
26
27     pp3 = <<-DOC
28       $output = concat(['1','2','3'],['4','5','6'],['7','8','9'])
29       validate_array($output)
30       if size($output) != 9 {
31         fail("${output} should have 9 elements.")
32       }
33     DOC
34     it 'concats multiple arrays to one' do
35       apply_manifest(pp3, :catch_failures => true)
36     end
37
38     pp4 = <<-DOC
39       $output = concat([{"a" => "b"}], {"c" => "d", "e" => "f"})
40       validate_array($output)
41       if size($output) != 2 {
42         fail("${output} should have 2 elements.")
43       }
44       if $output[1] != {"c" => "d", "e" => "f"} {
45         fail("${output} does not have the expected hash for the second element.")
46       }
47     DOC
48     it 'concats hash arguments' do
49       apply_manifest(pp4, :catch_failures => true)
50     end
51   end
52 end