зеркало из https://github.com/github/ruby.git
Use assert_separately to inspect test failure of TestJSONGenerate#test_broken_bignum
http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130617T010202Z.log.html.gz#test%2F-ext- git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0288c4bed1
Коммит
6a986298a4
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.join(File.dirname(__FILE__), 'setup_variant')
|
require File.join(File.dirname(__FILE__), 'setup_variant')
|
||||||
|
require_relative '../ruby/envutil.rb'
|
||||||
|
|
||||||
class TestJSONGenerate < Test::Unit::TestCase
|
class TestJSONGenerate < Test::Unit::TestCase
|
||||||
include JSON
|
include JSON
|
||||||
|
@ -215,15 +216,14 @@ EOT
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gc
|
def test_gc
|
||||||
require_relative '../ruby/envutil.rb'
|
assert_separately %w[-rjson --disable-gems], <<-EOS, timeout: 5
|
||||||
assert_in_out_err(%w[-rjson --disable-gems], <<-EOS, [], [])
|
|
||||||
bignum_too_long_to_embed_as_string = 1234567890123456789012345
|
bignum_too_long_to_embed_as_string = 1234567890123456789012345
|
||||||
expect = bignum_too_long_to_embed_as_string.to_s
|
expect = bignum_too_long_to_embed_as_string.to_s
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
|
|
||||||
10.times do |i|
|
10.times do |i|
|
||||||
tmp = bignum_too_long_to_embed_as_string.to_json
|
tmp = bignum_too_long_to_embed_as_string.to_json
|
||||||
raise "'\#{expect}' is expected, but '\#{tmp}'" unless tmp == expect
|
assert_equal expect, tmp
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
end if GC.respond_to?(:stress=)
|
end if GC.respond_to?(:stress=)
|
||||||
|
@ -252,27 +252,15 @@ EOT
|
||||||
assert_equal '5', state2.array_nl
|
assert_equal '5', state2.array_nl
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(JSON::Ext::Generator)
|
|
||||||
def test_broken_bignum # [ruby-core:38867]
|
def test_broken_bignum # [ruby-core:38867]
|
||||||
pid = fork do
|
assert_separately %w[-rjson --disable-gems], <<-EOS, timeout: 5
|
||||||
Bignum.class_eval do
|
Bignum.class_eval do
|
||||||
def to_s
|
def to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
begin
|
assert_raise(TypeError){ JSON::Ext::Generator::State.new.generate(1<<64) }
|
||||||
JSON::Ext::Generator::State.new.generate(1<<64)
|
EOS
|
||||||
exit 1
|
end if defined?(JSON::Ext::Generator)
|
||||||
rescue TypeError
|
|
||||||
exit 0
|
|
||||||
end
|
|
||||||
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
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_hash_likeness_set_symbol
|
def test_hash_likeness_set_symbol
|
||||||
state = JSON.state.new
|
state = JSON.state.new
|
||||||
|
|
Загрузка…
Ссылка в новой задаче