Note that exim contains tracker-specific configuration
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / shell_join_spec.rb
1 require 'spec_helper'
2
3 describe 'shell_join' do
4   it { is_expected.not_to eq(nil) }
5
6   describe 'signature validation' do
7     it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
8     it { is_expected.to run.with_params(['foo'], ['bar']).and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
9     it { is_expected.to run.with_params('foo').and_raise_error(Puppet::ParseError, %r{is not an Array}i) }
10   end
11
12   describe 'shell argument joining' do
13     it { is_expected.to run.with_params(['foo']).and_return('foo') }
14     it { is_expected.to run.with_params(['foo', 'bar']).and_return('foo bar') }
15     it { is_expected.to run.with_params(['foo', 'bar baz']).and_return('foo bar\ baz') }
16     it {
17       is_expected.to run.with_params(['~`!@#$', '%^&*()_+-=', '[]\{}|;\':"', ',./<>?'])
18                         .and_return('\~\`\!@\#\$ \%\^\&\*\(\)_\+-\= \[\]\\\\\{\}\|\;\\\':\" ,./\<\>\?')
19     }
20
21     context 'with UTF8 and double byte characters' do
22       it { is_expected.to run.with_params(['μťƒ', '8', 'ŧĕχť']).and_return('\\μ\\ť\\ƒ 8 \\ŧ\\ĕ\\χ\\ť') }
23       it { is_expected.to run.with_params(['スペー', 'スを含むテ', ' キスト']).and_return('\\ス\\ペ\\ー \\ス\\を\\含\\む\\テ \\ \\キ\\ス\\ト') }
24     end
25   end
26
27   describe 'stringification' do
28     it { is_expected.to run.with_params([10, false, 'foo']).and_return('10 false foo') }
29   end
30 end