diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_gc.rb | 82 | ||||
-rw-r--r-- | test/ruby/test_require.rb | 10 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 10 | ||||
-rw-r--r-- | test/ruby/test_thread.rb | 2 |
4 files changed, 52 insertions, 52 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 64a860fe65..c5a9731f8a 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -228,12 +228,12 @@ class TestGc < Test::Unit::TestCase def test_latest_gc_info omit 'stress' if GC.stress - assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom' - GC.start - count = GC.stat(:heap_free_slots) + GC.stat(:heap_allocatable_pages) * GC::INTERNAL_CONSTANTS[:HEAP_PAGE_OBJ_LIMIT] - count.times{ "a" + "b" } - assert_equal :newobj, GC.latest_gc_info[:gc_by] - eom + assert_separately([], __FILE__, __LINE__, <<-'RUBY') + GC.start + count = GC.stat(:heap_free_slots) + GC.stat(:heap_allocatable_pages) * GC::INTERNAL_CONSTANTS[:HEAP_PAGE_OBJ_LIMIT] + count.times{ "a" + "b" } + assert_equal :newobj, GC.latest_gc_info[:gc_by] + RUBY GC.latest_gc_info(h = {}) # allocate hash and rehearsal GC.start @@ -335,7 +335,7 @@ class TestGc < Test::Unit::TestCase end def test_stress_compile_send - assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "") + assert_in_out_err([], <<-EOS, [], [], "") GC.stress = true begin eval("A::B.c(1, 1, d: 234)") @@ -345,7 +345,7 @@ class TestGc < Test::Unit::TestCase end def test_singleton_method - assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:42832]") + assert_in_out_err([], <<-EOS, [], [], "[ruby-dev:42832]") GC.stress = true 10.times do obj = Object.new @@ -357,7 +357,7 @@ class TestGc < Test::Unit::TestCase end def test_singleton_method_added - assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:44436]") + assert_in_out_err([], <<-EOS, [], [], "[ruby-dev:44436]") class BasicObject undef singleton_method_added def singleton_method_added(mid) @@ -404,7 +404,7 @@ class TestGc < Test::Unit::TestCase "RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" => "0.4", } # always full GC when RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR < 1.0 - assert_in_out_err([env, "--disable-gems", "-e", "GC.start; 1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "") + assert_in_out_err([env, "-e", "GC.start; 1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "") end env = { @@ -505,19 +505,19 @@ class TestGc < Test::Unit::TestCase def test_profiler_clear omit "for now" - assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom', timeout: 30 - GC::Profiler.enable + assert_separately([], __FILE__, __LINE__, <<-'RUBY', timeout: 30) + GC::Profiler.enable - GC.start - assert_equal(1, GC::Profiler.raw_data.size) - GC::Profiler.clear - assert_equal(0, GC::Profiler.raw_data.size) - - 200.times{ GC.start } - assert_equal(200, GC::Profiler.raw_data.size) - GC::Profiler.clear - assert_equal(0, GC::Profiler.raw_data.size) - eom + GC.start + assert_equal(1, GC::Profiler.raw_data.size) + GC::Profiler.clear + assert_equal(0, GC::Profiler.raw_data.size) + + 200.times{ GC.start } + assert_equal(200, GC::Profiler.raw_data.size) + GC::Profiler.clear + assert_equal(0, GC::Profiler.raw_data.size) + RUBY end def test_profiler_total_time @@ -531,34 +531,34 @@ class TestGc < Test::Unit::TestCase end def test_finalizing_main_thread - assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]") + assert_in_out_err([], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]") ObjectSpace.define_finalizer(Thread.main) { p 'finalize' } EOS end def test_expand_heap - assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom' - GC.start - base_length = GC.stat[:heap_eden_pages] - (base_length * 500).times{ 'a' } - GC.start - base_length = GC.stat[:heap_eden_pages] - (base_length * 500).times{ 'a' } - GC.start - assert_in_epsilon base_length, (v = GC.stat[:heap_eden_pages]), 1/8r, - "invalid heap expanding (base_length: #{base_length}, GC.stat[:heap_eden_pages]: #{v})" + assert_separately([], __FILE__, __LINE__, <<~'RUBY') + GC.start + base_length = GC.stat[:heap_eden_pages] + (base_length * 500).times{ 'a' } + GC.start + base_length = GC.stat[:heap_eden_pages] + (base_length * 500).times{ 'a' } + GC.start + assert_in_epsilon base_length, (v = GC.stat[:heap_eden_pages]), 1/8r, + "invalid heap expanding (base_length: #{base_length}, GC.stat[:heap_eden_pages]: #{v})" - a = [] - (base_length * 500).times{ a << 'a'; nil } - GC.start - assert_operator base_length, :<, GC.stat[:heap_eden_pages] + 1 - eom + a = [] + (base_length * 500).times{ a << 'a'; nil } + GC.start + assert_operator base_length, :<, GC.stat[:heap_eden_pages] + 1 + RUBY end def test_thrashing_for_young_objects # This test prevents bugs like [Bug #18929] - assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'RUBY' + assert_separately([], __FILE__, __LINE__, <<-'RUBY') # Grow the heap @ary = 100_000.times.map { Object.new } @@ -648,11 +648,11 @@ class TestGc < Test::Unit::TestCase end def test_finalizer_passed_object_id - assert_in_out_err(%w[--disable-gems], <<-EOS, ["true"], []) + assert_in_out_err([], <<~RUBY, ["true"], []) o = Object.new obj_id = o.object_id ObjectSpace.define_finalizer(o, ->(id){ p id == obj_id }) - EOS + RUBY end def test_verify_internal_consistency diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 49c771c33c..cadab4f851 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -193,7 +193,7 @@ class TestRequire < Test::Unit::TestCase File.write(req, "p :ok\n") assert_file.exist?(req) req[/.rb$/i] = "" - assert_in_out_err(['--disable-gems'], <<-INPUT, %w(:ok), []) + assert_in_out_err([], <<-INPUT, %w(:ok), []) require "#{req}" require "#{req}" INPUT @@ -681,7 +681,7 @@ class TestRequire < Test::Unit::TestCase Dir.mktmpdir {|tmp| Dir.chdir(tmp) { open("foo.rb", "w") {} - assert_in_out_err([{"RUBYOPT"=>nil}, '--disable-gems'], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158) + assert_in_out_err([{"RUBYOPT"=>nil}], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158) begin; $:.replace([IO::NULL]) a = Object.new @@ -709,7 +709,7 @@ class TestRequire < Test::Unit::TestCase Dir.mktmpdir {|tmp| Dir.chdir(tmp) { open("foo.rb", "w") {} - assert_in_out_err([{"RUBYOPT"=>nil}, '--disable-gems'], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158) + assert_in_out_err([{"RUBYOPT"=>nil}], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158) begin; $:.replace([IO::NULL]) a = Object.new @@ -739,7 +739,7 @@ class TestRequire < Test::Unit::TestCase open("foo.rb", "w") {} Dir.mkdir("a") open(File.join("a", "bar.rb"), "w") {} - assert_in_out_err(['--disable-gems'], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7383) + assert_in_out_err([], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7383) begin; $:.replace([IO::NULL]) $:.#{add} "#{tmp}" @@ -963,7 +963,7 @@ class TestRequire < Test::Unit::TestCase def test_require_with_public_method_missing # [Bug #19793] - assert_separately(["-W0", "--disable-gems", "-rtempfile"], __FILE__, __LINE__, <<~RUBY) + assert_separately(["-W0", "-rtempfile"], __FILE__, __LINE__, <<~RUBY) GC.stress = true class Object diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 3d98cd6f4e..20fa15604d 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -135,12 +135,12 @@ class TestRubyOptions < Test::Unit::TestCase end def test_debug - assert_in_out_err(["--disable-gems", "-de", "p $DEBUG"], "", %w(true), []) + assert_in_out_err(["-de", "p $DEBUG"], "", %w(true), []) - assert_in_out_err(["--disable-gems", "--debug", "-e", "p $DEBUG"], + assert_in_out_err(["--debug", "-e", "p $DEBUG"], "", %w(true), []) - assert_in_out_err(["--disable-gems", "--debug-", "-e", "p $DEBUG"], "", %w(), /invalid option --debug-/) + assert_in_out_err(["--debug-", "-e", "p $DEBUG"], "", %w(), /invalid option --debug-/) end q = Regexp.method(:quote) @@ -211,9 +211,9 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(--disable foobarbazqux -e) + [""], "", [], /unknown argument for --disable: `foobarbazqux'/) assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/) - assert_in_out_err(%w(--disable-gems -e) + ['p defined? Gem'], "", ["nil"], []) + assert_in_out_err(%w(-e) + ['p defined? Gem'], "", ["nil"], []) assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], []) - assert_in_out_err(%w(--disable-gems -e) + ['p defined? DidYouMean'], "", ["nil"], []) + assert_in_out_err(%w(-e) + ['p defined? DidYouMean'], "", ["nil"], []) end def test_kanji diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index e6f347c486..703373b11e 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -395,7 +395,7 @@ class TestThread < Test::Unit::TestCase end INPUT - assert_in_out_err(%w(--disable-gems -d), <<-INPUT, %w(false 2), %r".+") + assert_in_out_err(%w(-d), <<-INPUT, %w(false 2), %r".+") p Thread.abort_on_exception begin t = Thread.new { raise } |