Update stdlib
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / concat_spec.rb
1 require 'spec_helper'
2
3 describe 'concat' do
4   it { is_expected.not_to eq(nil) }
5   it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
6   it { is_expected.to run.with_params([1]).and_raise_error(Puppet::ParseError) }
7   it { is_expected.to run.with_params(1, [2]).and_raise_error(Puppet::ParseError) }
8   it { is_expected.to run.with_params([1], [2], [3]).and_return([1, 2, 3]) }
9   it { is_expected.to run.with_params(['1','2','3'],['4','5','6']).and_return(['1','2','3','4','5','6']) }
10   it { is_expected.to run.with_params(['1','2','3'],'4').and_return(['1','2','3','4']) }
11   it { is_expected.to run.with_params(['1','2','3'],[['4','5'],'6']).and_return(['1','2','3',['4','5'],'6']) }
12   it { is_expected.to run.with_params(['1','2'],['3','4'],['5','6']).and_return(['1','2','3','4','5','6']) }
13   it { is_expected.to run.with_params(['1','2'],'3','4',['5','6']).and_return(['1','2','3','4','5','6']) }
14
15 context 'should run with UTF8 and double byte characters' do
16   it { is_expected.to run.with_params([{"a" => "b"}], {"c" => "d", "e" => "f"}).and_return([{"a" => "b"}, {"c" => "d", "e" => "f"}]) }
17   it { is_expected.to run.with_params(['ấ','β','©'],['đ','ể','文字列']).and_return(['ấ','β','©','đ','ể','文字列']) }
18 end
19
20   it "should leave the original array intact" do
21     argument1 = ['1','2','3']
22     original1 = argument1.dup
23     argument2 = ['4','5','6']
24     original2 = argument2.dup
25     result = subject.call([argument1,argument2])
26     expect(argument1).to eq(original1)
27     expect(argument2).to eq(original2)
28   end
29 end