From 61891bbe6112b580043e9d8c256f722a6add9492 Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Thu, 29 Mar 2012 15:12:06 -0700 Subject: (#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. --- lib/puppet/parser/functions/range.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/puppet/parser/functions/range.rb') 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| -- cgit v1.2.3