File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
lib/puppet/parser/functions Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,11 @@ module Puppet::Parser::Functions
13
13
# Sometimes we get numbers as numerics and sometimes as strings.
14
14
# We try to compare them as numbers when possible
15
15
return args . min do |a , b |
16
- a . to_f <=> b . to_f if a . to_s =~ %r{\A ^-?\d +(.\d +)?\z } && b . to_s =~ %r{\A -?\d +(.\d +)?\z }
17
- a . to_s <=> b . to_s
16
+ if a . to_s =~ %r{\A ^-?\d +(.\d +)?\z } && b . to_s =~ %r{\A -?\d +(.\d +)?\z }
17
+ a . to_f <=> b . to_f
18
+ else
19
+ a . to_s <=> b . to_s
20
+ end
18
21
end
19
22
end
20
23
end
Original file line number Diff line number Diff line change 7
7
it { is_expected . to run . with_params ( 1 , 2 ) . and_return ( 1 ) }
8
8
it { is_expected . to run . with_params ( 1 , 2 , 3 ) . and_return ( 1 ) }
9
9
it { is_expected . to run . with_params ( 3 , 2 , 1 ) . and_return ( 1 ) }
10
+ it { is_expected . to run . with_params ( 12 , 8 ) . and_return ( 8 ) }
10
11
it { is_expected . to run . with_params ( 'one' ) . and_return ( 'one' ) }
11
12
it { is_expected . to run . with_params ( 'one' , 'two' ) . and_return ( 'one' ) }
12
13
it { is_expected . to run . with_params ( 'one' , 'two' , 'three' ) . and_return ( 'one' ) }
You can’t perform that action at this time.
0 commit comments