File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
lib/puppet/parser/functions
spec/unit/parser/functions Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ module Puppet::Parser::Functions
12
12
"given #{ arguments . size } for 1" )
13
13
end
14
14
15
+ value = arguments [ 0 ]
16
+
17
+ if value != value . to_f . to_s then
18
+ return false
19
+ else
20
+ return true
21
+ end
22
+
15
23
end
16
24
end
17
25
Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ module Puppet::Parser::Functions
12
12
"given #{ arguments . size } for 1" )
13
13
end
14
14
15
+ value = arguments [ 0 ]
16
+
17
+ if value != value . to_i . to_s then
18
+ return false
19
+ else
20
+ return true
21
+ end
22
+
15
23
end
16
24
end
17
25
Original file line number Diff line number Diff line change 19
19
end
20
20
21
21
it "should return true if a float" do
22
- result = @scope . function_is_float ( [ 0.12 ] )
22
+ result = @scope . function_is_float ( [ " 0.12" ] )
23
23
result . should ( eq ( true ) )
24
24
end
25
25
29
29
end
30
30
31
31
it "should return false if not an integer" do
32
- result = @scope . function_is_float ( [ 3 ] )
32
+ result = @scope . function_is_float ( [ "3" ] )
33
33
result . should ( eq ( false ) )
34
34
end
35
35
Original file line number Diff line number Diff line change 19
19
end
20
20
21
21
it "should return true if an integer" do
22
- result = @scope . function_is_integer ( [ 3 ] )
22
+ result = @scope . function_is_integer ( [ "3" ] )
23
23
result . should ( eq ( true ) )
24
24
end
25
25
26
26
it "should return false if a float" do
27
- result = @scope . function_is_integer ( [ 3.2 ] )
27
+ result = @scope . function_is_integer ( [ " 3.2" ] )
28
28
result . should ( eq ( false ) )
29
29
end
30
30
You can’t perform that action at this time.
0 commit comments