Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / size_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'size function', :if => Puppet::Util::Package.versioncmp(return_puppet_version, '6.0.0') < 0 do
4   describe 'success' do
5     pp1 = <<-DOC
6       $a = 'discombobulate'
7       $o = size($a)
8       notice(inline_template('size is <%= @o.inspect %>'))
9     DOC
10     it 'single string size' do
11       apply_manifest(pp1, :catch_failures => true) do |r|
12         expect(r.stdout).to match(%r{size is 14})
13       end
14     end
15
16     pp2 = <<-DOC
17       $a = ''
18       $o = size($a)
19       notice(inline_template('size is <%= @o.inspect %>'))
20     DOC
21     it 'with empty string' do
22       apply_manifest(pp2, :catch_failures => true) do |r|
23         expect(r.stdout).to match(%r{size is 0})
24       end
25     end
26
27     pp3 = <<-DOC
28       $a = undef
29       $o = size($a)
30       notice(inline_template('size is <%= @o.inspect %>'))
31     DOC
32     it 'with undef' do
33       apply_manifest(pp3, :catch_failures => true) do |r|
34         expect(r.stdout).to match(%r{size is 0})
35       end
36     end
37
38     pp4 = <<-DOC
39       $a = ['discombobulate', 'moo']
40       $o = size($a)
41       notice(inline_template('size is <%= @o.inspect %>'))
42     DOC
43     it 'strings in array' do
44       apply_manifest(pp4, :catch_failures => true) do |r|
45         expect(r.stdout).to match(%r{size is 2})
46       end
47     end
48   end
49   describe 'failure' do
50     it 'handles no arguments'
51     it 'handles non strings or arrays'
52   end
53 end