Skip to content

Commit

Permalink
Add test for seg faults in SAJ pparser
Browse files Browse the repository at this point in the history
This adds a test for ohler55#799.
  • Loading branch information
stanhu committed Jul 29, 2022
1 parent 438361a commit cbb8d82
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_parser_saj.rb
Expand Up @@ -149,6 +149,17 @@ def test_float_exp
assert_equal((12345.6789e7 * 10000).to_i, (handler.calls[0][1] * 10000).to_i)
end

def test_bignum
handler = AllSaj.new()
json = %{-11.899999999999999}
p = Oj::Parser.new(:saj)
p.handler = handler
p.parse(json)
assert_equal(1, handler.calls.size)
assert_equal(:add_value, handler.calls[0][0])
assert_equal(-118999, (handler.calls[0][1] * 10000).to_i)
end

def test_array_empty
handler = AllSaj.new()
json = %{[]}
Expand Down

0 comments on commit cbb8d82

Please sign in to comment.