Age | Commit message (Collapse) | Author |
|
When validate_string is called via the Puppet 4 deprecation wrappers
from deprecation_gen (introduced in 970852d), `undef` is passed as `nil`
where it was previously passed as `''` from the Puppet 3-style function
API.
This change explicitly permits a `nil` value in validate_string, and
adds a test case to `is_string` which also accepts the same.
Fixes test failures in apt, concat etc:
Error while evaluating a Function Call, nil is not a string. It looks to be a NilClass at apt/manifests/source.pp:23:3 [..]
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:34:in `block (2 levels) in <module:Functions>'
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `each'
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `block in <module:Functions>'
# puppet-4.7.0/lib/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction'
# puppet-4.7.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
# puppet-4.7.0/lib/puppet/util/profiler.rb:51:in `profile'
# puppet-4.7.0/lib/puppet/parser/functions.rb:167:in `block in newfunction'
# ./spec/fixtures/modules/stdlib/lib/puppet_x/puppetlabs/stdlib/deprecation_gen.rb:13:in `block (2 levels) in deprecation_gen'
|
|
|
|
|
|
The deprecation function was calling the `Kernel#warn` function which
prints to stderr, rather than the Puppet logger. This causes problems
for Puppet module tests on Travis CI, which has a cap on the amount of
stdout/err permitted in its logs and also prevents users from finding
the deprecation warnings when running under a Puppet master.
|
|
|
|
Tests in the new style produces the following documentation output:
abs
should not eq nil
should run abs() and raise an Puppet::ParseError
should run abs(-34) and return 34
should run abs("-34") and return 34
should run abs(34) and return 34
should run abs("34") and return 34
|
|
rspec-puppet matchers are defined for tests which exist in
spec/functions, but the function unit tests lived in
spec/unit/puppet/parser/functions. This moves them to the correct place
for using rspec-puppet
|