Skip to content

Commit

Permalink
Add additional literal evaluator tests
Browse files Browse the repository at this point in the history
The "undef to nil" test is special because otherwise the value nil when
interpolated in the name of the test results in empty string.
  • Loading branch information
joshcooper committed Feb 29, 2024
1 parent a8d2cd1 commit c797f18
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/unit/pops/evaluator/literal_evaluator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,26 @@
'"a"' => 'a',
'a' => 'a',
'a::b' => 'a::b',
'Boolean[true]' => [true],
'Integer[1]' => [1],
'Integer[-1]' => [-1],
'Integer[-5, -1]' => [-5, -1],
'Integer[-5, 5]' => [-5, 5],
# we can't actually represent MIN_INTEGER because it's glexed as
# UnaryMinusExpression containing a positive LiteralInteger and the integer
# must be <= MAX_INTEGER
"Integer[#{Puppet::Pops::MIN_INTEGER + 1}]" => [-0x7FFFFFFFFFFFFFFF],
"Integer[0, #{Puppet::Pops::MAX_INTEGER}]" => [0, 0x7FFFFFFFFFFFFFFF],
'Integer[0, default]' => [0, :default],
'Integer[Infinity]' => ['infinity'],
'Float[Infinity]' => ['infinity'],
'Array[Integer, 1]' => ['integer', 1],
'Hash[Integer, String, 1, 3]' => ['integer', 'string', 1, 3],
'Regexp[/-1/]' => [/-1/],
'Sensitive[-1]' => [-1],
'Timespan[-5, 5]' => [-5, 5],
'Timestamp["2012-10-10", 1]' => ['2012-10-10', 1],
'Undef' => 'undef',
'File' => "file",

# special values
Expand Down

0 comments on commit c797f18

Please sign in to comment.