Skip to content

Commit 7f438d2

Browse files
committed
Add additional literal evaluator tests
1 parent 147a577 commit 7f438d2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/unit/pops/evaluator/literal_evaluator_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,32 @@
1111
"3.14" => 3.14,
1212
"true" => true,
1313
"false" => false,
14+
"undef" => nil,
1415
"'1'" => '1',
1516
"'a'" => 'a',
1617
'"a"' => 'a',
1718
'a' => 'a',
1819
'a::b' => 'a::b',
20+
'Boolean[true]' => [true],
1921
'Integer[1]' => [1],
22+
'Integer[-1]' => [-1],
23+
'Integer[-5, -1]' => [-5, -1],
24+
'Integer[-5, 5]' => [-5, 5],
25+
# we can't actually represent MIN_INTEGER because it's glexed as
26+
# UnaryMinusExpression containing a positive LiteralInteger and the integer
27+
# must be <= MAX_INTEGER
28+
"Integer[#{Puppet::Pops::MIN_INTEGER + 1}]" => [-0x7FFFFFFFFFFFFFFF],
29+
"Integer[0, #{Puppet::Pops::MAX_INTEGER}]" => [0, 0x7FFFFFFFFFFFFFFF],
30+
'Integer[0, default]' => [0, :default],
31+
'Integer[Infinity]' => ['infinity'],
32+
'Float[Infinity]' => ['infinity'],
33+
'Array[Integer, 1]' => ['integer', 1],
34+
'Hash[Integer, String, 1, 3]' => ['integer', 'string', 1, 3],
35+
'Regexp[/-1/]' => [/-1/],
36+
'Sensitive[-1]' => [-1],
37+
'Timespan[-5, 5]' => [-5, 5],
38+
'Timestamp["2012-10-10", 1]' => ['2012-10-10', 1],
39+
'Undef' => 'undef',
2040
'File' => "file",
2141

2242
# special values

0 commit comments

Comments
 (0)