./tests/test_json_generate.rb in json-maglev--1.6.5 vs ./tests/test_json_generate.rb in json-maglev--1.6.7

- old
+ new

@@ -2,11 +2,11 @@ # -*- coding: utf-8 -*- require 'test/unit' require File.join(File.dirname(__FILE__), 'setup_variant') -class TC_JSONGenerate < Test::Unit::TestCase +class TestJSONGenerate < Test::Unit::TestCase include JSON def setup @hash = { 'a' => 2, @@ -225,25 +225,27 @@ end ensure GC.stress = stress end if GC.respond_to?(:stress=) - def test_broken_bignum # [ruby-core:38867] - pid = fork do - Bignum.class_eval do - def to_s + if defined?(JSON::Ext::Generator) + def test_broken_bignum # [ruby-core:38867] + pid = fork do + Bignum.class_eval do + def to_s + end end + begin + JSON::Ext::Generator::State.new.generate(1<<64) + exit 1 + rescue TypeError + exit 0 + end end - begin - JSON::Ext::Generator::State.new.generate(1<<64) - exit 1 - rescue TypeError - exit 0 - end + _, status = Process.waitpid2(pid) + assert status.success? + rescue NotImplementedError + # forking to avoid modifying core class of a parent process and + # introducing race conditions of tests are run in parallel end - _, status = Process.waitpid2(pid) - assert status.success? - rescue NotImplementedError - # forking to avoid modifying core class of a parent process and - # introducing race conditions of tests are run in parallel - end if defined?(JSON::Ext) + end end