Skip to content

Commit 722022d

Browse files
joshcoopergithub-actions[bot]
authored andcommitted
Add additional literal evaluator tests
The "undef to nil" test is special because otherwise the value nil when interpolated in the name of the test results in empty string. (cherry picked from commit 17ba937)
1 parent 105c163 commit 722022d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/unit/pops/evaluator/literal_evaluator_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,26 @@
1616
'"a"' => 'a',
1717
'a' => 'a',
1818
'a::b' => 'a::b',
19+
'Boolean[true]' => [true],
1920
'Integer[1]' => [1],
2021
'Integer[-1]' => [-1],
22+
'Integer[-5, -1]' => [-5, -1],
23+
'Integer[-5, 5]' => [-5, 5],
24+
# we can't actually represent MIN_INTEGER because it's glexed as
25+
# UnaryMinusExpression containing a positive LiteralInteger and the integer
26+
# must be <= MAX_INTEGER
27+
"Integer[#{Puppet::Pops::MIN_INTEGER + 1}]" => [-0x7FFFFFFFFFFFFFFF],
28+
"Integer[0, #{Puppet::Pops::MAX_INTEGER}]" => [0, 0x7FFFFFFFFFFFFFFF],
29+
'Integer[0, default]' => [0, :default],
30+
'Integer[Infinity]' => ['infinity'],
31+
'Float[Infinity]' => ['infinity'],
32+
'Array[Integer, 1]' => ['integer', 1],
33+
'Hash[Integer, String, 1, 3]' => ['integer', 'string', 1, 3],
34+
'Regexp[/-1/]' => [/-1/],
35+
'Sensitive[-1]' => [-1],
36+
'Timespan[-5, 5]' => [-5, 5],
37+
'Timestamp["2012-10-10", 1]' => ['2012-10-10', 1],
38+
'Undef' => 'undef',
2139
'File' => "file",
2240

2341
# special values

0 commit comments

Comments
 (0)