diff options
author | Jeff McCune <jeff@puppetlabs.com> | 2012-03-29 15:12:06 -0700 |
---|---|---|
committer | Jeff McCune <jeff@puppetlabs.com> | 2012-03-29 15:17:30 -0700 |
commit | 61891bbe6112b580043e9d8c256f722a6add9492 (patch) | |
tree | 2f36806174ae5c791ed5453fd2bcbaf55993f417 /lib/puppet/parser/functions | |
parent | 46401caef6e00708867d09319985528c39636ba2 (diff) | |
download | puppet-stdlib-61891bbe6112b580043e9d8c256f722a6add9492.tar.gz puppet-stdlib-61891bbe6112b580043e9d8c256f722a6add9492.tar.bz2 |
(#13494) Specify the behavior of zero padded strings
Without this patch the specified behavior of strings that are numeric
only and zero padded is unclear and untested in the spec tests. This is
a problem because it's not clear that range('00', '10') will actually
return [ "0", "1", ..., "10" ] instead of [ "00", "01", ..., "10" ]
This patch addresses the issue by providing explicit test coverage. If
the string conversion behavior of puppet changes, this test will begin
to fail.
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r-- | lib/puppet/parser/functions/range.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/range.rb b/lib/puppet/parser/functions/range.rb index 6e85422..825617b 100644 --- a/lib/puppet/parser/functions/range.rb +++ b/lib/puppet/parser/functions/range.rb @@ -15,9 +15,18 @@ an array. Will return: [0,1,2,3,4,5,6,7,8,9] + range("00", "09") + +Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to +integers automatically) + range("a", "c") Will return: ["a","b","c"] + + range("host01", "host10") + +Will return: ["host01", "host02", ..., "host09", "host10"] EOS ) do |arguments| |