Skip to content

Commit 3e19e09

Browse files
committed
acceptance_test_fixes
1 parent d303fff commit 3e19e09

File tree

13 files changed

+46
-23
lines changed

13 files changed

+46
-23
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,8 @@ Converts the case of a string or of all strings in an array to lowercase.
11631163

11641164
#### `empty`
11651165

1166+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `empty` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
1167+
11661168
Returns `true` if the argument is an array or hash that contains no elements, or an empty string. Returns `false` when the argument is a numerical value.
11671169

11681170
*Type*: rvalue.
@@ -1274,6 +1276,8 @@ fact('vmware."VRA.version"')
12741276

12751277
#### `flatten`
12761278

1279+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `flatten` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
1280+
12771281
Flattens deeply nested arrays and returns a single flat array as a result.
12781282

12791283
For example, `flatten(['a', ['b', ['c']]])` returns ['a','b','c'].
@@ -1631,6 +1635,8 @@ Returns `true` if the variable passed to this function is a string.
16311635

16321636
#### `join`
16331637

1638+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `join` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
1639+
16341640
Joins an array into a string using a separator. For example, `join(['a','b','c'], ",")` results in: "a,b,c".
16351641

16361642
*Type*: rvalue.
@@ -1647,12 +1653,16 @@ For example, `join_keys_to_values({'a'=>1,'b'=>[2,3]}, " is ")` results in ["a i
16471653

16481654
#### `keys`
16491655

1656+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `keys` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
1657+
16501658
Returns the keys of a hash as an array.
16511659

16521660
*Type*: rvalue.
16531661

16541662
#### `length`
16551663

1664+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `length` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
1665+
16561666
Returns the length of a given string, array or hash. Replaces the deprecated `size()` function.
16571667

16581668
*Type*: rvalue.
@@ -2774,6 +2784,8 @@ validate_x509_rsa_key_pair($cert, $key)
27742784

27752785
#### `values`
27762786

2787+
**Deprecated. Puppet 5.5.0 has introduced an inbuilt `values` function, that will take precedence over the stdlib function. See [Puppet 5.5.0 Release Notes](https://puppet.com/docs/puppet/5.5/release_notes.html#new-features).**
2788+
27772789
Returns the values of a given hash.
27782790

27792791
For example, given `$hash = {'a'=1, 'b'=2, 'c'=3} values($hash)` returns [1,2,3].

lib/puppet/parser/functions/empty.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module Puppet::Parser::Functions
77
DOC
88
) do |arguments|
99

10+
function_deprecation([:empty, 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes.'])
11+
1012
raise(Puppet::ParseError, "empty(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
1113
value = arguments[0]
1214

lib/puppet/parser/functions/flatten.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ module Puppet::Parser::Functions
1414
DOC
1515
) do |arguments|
1616

17+
function_deprecation([:flatten, 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes'])
18+
1719
raise(Puppet::ParseError, "flatten(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
1820

1921
array = arguments[0]

lib/puppet/parser/functions/join.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module Puppet::Parser::Functions
1313
DOC
1414
) do |arguments|
1515

16+
function_deprecation([:join, 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes'])
17+
1618
# Technically we support two arguments but only first is mandatory ...
1719
raise(Puppet::ParseError, "join(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
1820

lib/puppet/parser/functions/keys.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module Puppet::Parser::Functions
77
DOC
88
) do |arguments|
99

10+
function_deprecation([:keys, 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes.'])
11+
1012
raise(Puppet::ParseError, "keys(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
1113

1214
hash = arguments[0]

lib/puppet/parser/functions/values.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module Puppet::Parser::Functions
2020
DOC
2121
) do |arguments|
2222

23+
function_deprecation([:values, 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes.'])
24+
2325
raise(Puppet::ParseError, "values(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
2426

2527
hash = arguments[0]

spec/acceptance/values_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
notice(inline_template('<%= @output.inspect %>'))
2424
DOC
2525
it 'handles non-hash arguments' do
26-
expect(apply_manifest(pp2, :expect_failures => true).stderr).to match(%r{Requires hash})
26+
expect(apply_manifest(pp2, :expect_failures => true).stderr).to match(%r{Requires hash}) if return_puppet_version < '5.5.0'
27+
expect(apply_manifest(pp2, :expect_failures => true).stderr).to match(%r{expects a Hash value}) if return_puppet_version >= '5.5.0'
2728
end
2829
end
2930
end

spec/functions/empty_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe 'empty' do
44
it { is_expected.not_to eq(nil) }
5-
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) }
5+
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) } if Puppet.version < '5.5.0'
66
it {
77
pending('Current implementation ignores parameters after the first.')
88
is_expected.to run.with_params('one', 'two').and_raise_error(Puppet::ParseError)

spec/functions/flatten_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
describe 'flatten' do
44
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([], []).and_raise_error(Puppet::ParseError) }
7-
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
8-
it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError) }
5+
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) } if Puppet.version < '5.5.0'
6+
it { is_expected.to run.with_params([], []).and_raise_error(Puppet::ParseError) } if Puppet.version < '5.5.0'
7+
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) } if Puppet.version < '5.5.0'
8+
it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError) } if Puppet.version < '5.5.0'
99
it { is_expected.to run.with_params([]).and_return([]) }
1010
it { is_expected.to run.with_params(['one']).and_return(['one']) }
1111
it { is_expected.to run.with_params([['one']]).and_return(['one']) }

spec/functions/join_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
describe 'join' do
44
it { is_expected.not_to eq(nil) }
5-
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
5+
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } if Puppet.version < '5.5.0'
66
it {
77
pending('Current implementation ignores parameters after the second.')
88
is_expected.to run.with_params([], '', '').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i)
99
}
10-
it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, %r{Requires array to work with}) }
11-
it { is_expected.to run.with_params([], 2).and_raise_error(Puppet::ParseError, %r{Requires string to work with}) }
10+
it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, %r{Requires array to work with}) } if Puppet.version < '5.5.0'
11+
it { is_expected.to run.with_params([], 2).and_raise_error(Puppet::ParseError, %r{Requires string to work with}) } if Puppet.version < '5.5.0'
1212

1313
it { is_expected.to run.with_params([]).and_return('') }
1414
it { is_expected.to run.with_params([], ':').and_return('') }

spec/functions/keys_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
describe 'keys' do
44
it { is_expected.not_to eq(nil) }
5-
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
5+
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } if Puppet.version < '5.5.0'
66
it {
77
pending('Current implementation ignores parameters after the first.')
88
is_expected.to run.with_params({}, {}).and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i)
99
}
10-
it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) }
11-
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) }
12-
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) }
10+
it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
11+
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
12+
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
1313
it { is_expected.to run.with_params({}).and_return([]) }
1414
it { is_expected.to run.with_params('key' => 'value').and_return(['key']) }
15-
it 'returns the array of keys' do
15+
it 'returns the array of keys', if: Puppet.version < '5.5.0' do
1616
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2' }])
1717
expect(result).to match_array(%w[key1 key2])
1818
end
1919

20-
it 'runs with UTF8 and double byte characters' do
20+
it 'runs with UTF8 and double byte characters', if: Puppet.version < '5.5.0' do
2121
result = subject.call([{ 'ҝểү' => '√ẳŀμệ', 'キー' => '値' }])
2222
expect(result).to match_array(%w[ҝểү キー])
2323
end

spec/functions/length_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
it { is_expected.not_to eq(nil) }
55
it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{'length' expects 1 argument, got none}) }
66
it { is_expected.to run.with_params([], 'extra').and_raise_error(ArgumentError, %r{'length' expects 1 argument, got 2}) }
7-
it { is_expected.to run.with_params(1).and_raise_error(ArgumentError, %r{expects a value of type String, Array, or Hash, got Integer}) }
8-
it { is_expected.to run.with_params(true).and_raise_error(ArgumentError, %r{expects a value of type String, Array, or Hash, got Boolean}) }
7+
it { is_expected.to run.with_params(1).and_raise_error(ArgumentError, %r{expects a value of type String, Array, or Hash, got Integer}) } if Puppet.version < '5.5.0'
8+
it { is_expected.to run.with_params(true).and_raise_error(ArgumentError, %r{expects a value of type String, Array, or Hash, got Boolean}) } if Puppet.version < '5.5.0'
99
it { is_expected.to run.with_params('1').and_return(1) }
1010
it { is_expected.to run.with_params('1.0').and_return(3) }
1111
it { is_expected.to run.with_params([]).and_return(0) }

spec/functions/values_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
describe 'values' do
44
it { is_expected.not_to eq(nil) }
5-
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
5+
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } if Puppet.version < '5.5.0'
66
it {
77
pending('Current implementation ignores parameters after the first.')
88
is_expected.to run.with_params({}, 'extra').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i)
99
}
10-
it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) }
11-
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) }
12-
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) }
10+
it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
11+
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
12+
it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Requires hash to work with}) } if Puppet.version < '5.5.0'
1313
it { is_expected.to run.with_params({}).and_return([]) }
1414
it { is_expected.to run.with_params('key' => 'value').and_return(['value']) }
15-
it 'returns the array of values' do
15+
it 'returns the array of values', if: Puppet.version < '5.5.0' do
1616
result = subject.call([{ 'key1' => 'value1', 'key2' => 'value2', 'duplicate_value_key' => 'value2' }])
1717
expect(result).to match_array(%w[value1 value2 value2])
1818
end
1919

20-
it 'runs with UTF8 and double byte characters' do
20+
it 'runs with UTF8 and double byte characters', if: Puppet.version < '5.5.0' do
2121
result = subject.call([{ 'かぎ' => '使用', 'ҝĕұ' => '√ẩŀứệ', 'ҝĕұďŭрļǐçằťè' => '√ẩŀứệ' }])
2222
expect(result).to match_array(['使用', '√ẩŀứệ', '√ẩŀứệ'])
2323
end

0 commit comments

Comments
 (0)