diff options
author | Florian Frank <flori@ping.de> | 2011-08-29 23:10:36 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2011-08-29 23:10:36 +0200 |
commit | e63431185a04d897c70fdef57e4260f410d997c2 (patch) | |
tree | c2dc96fad99a86081555a032ab4e5f110286f424 /tests | |
parent | 2b5de6d03750b113333eded00177b14f8719042e (diff) | |
download | json-e63431185a04d897c70fdef57e4260f410d997c2.tar.gz |
Apply patch by Eric Wong <nocode@yhbt.net>
See https://github.com/flori/json/issues/46
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_json_generate.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index dc1450a..da96603 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -197,4 +197,17 @@ EOT assert_raises(JSON::NestingError) { ary.to_json(s) } assert_equal 19, s.depth end + + def test_gc + bignum_too_long_to_embed_as_string = 1234567890123456789012345 + expect = bignum_too_long_to_embed_as_string.to_s + stress, GC.stress = GC.stress, true + + 10.times do |i| + tmp = bignum_too_long_to_embed_as_string.to_json + assert_equal expect, tmp + end + ensure + GC.stress = stress + end if GC.respond_to?(:stress=) end |