Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / chop_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'chop function', :if => Puppet::Util::Package.versioncmp(return_puppet_version, '6.0.0') < 0 do
4   describe 'success' do
5     pp1 = <<-DOC
6       $input = "test"
7       if size($input) != 4 {
8         fail("Size of ${input} is not 4.")
9       }
10       $output = chop($input)
11       if size($output) != 3 {
12         fail("Size of ${input} is not 3.")
13       }
14     DOC
15     it 'eats the last character' do
16       apply_manifest(pp1, :catch_failures => true)
17     end
18
19     pp2 = <<-'DOC'
20       $input = "test\r\n"
21       if size($input) != 6 {
22         fail("Size of ${input} is not 6.")
23       }
24       $output = chop($input)
25       if size($output) != 4 {
26         fail("Size of ${input} is not 4.")
27       }
28     DOC
29     it 'eats the last two characters of \r\n' do
30       apply_manifest(pp2, :catch_failures => true)
31     end
32
33     pp3 = <<-DOC
34       $input = ""
35       $output = chop($input)
36     DOC
37     it 'does not fail on empty strings' do
38       apply_manifest(pp3, :catch_failures => true)
39     end
40   end
41 end