Skip to content

Commit

Permalink
Fix small issues concerning namespacing in test-all suite
Browse files Browse the repository at this point in the history
* Fix temporary methods on Object leaking across test cases.
* Remove temporary classes/modules leaking across test cases.
  • Loading branch information
luke-gru authored and hsbt committed Mar 16, 2023
1 parent 5825d7d commit d2c6dca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/-ext-/iseq_load/test_iseq_load.rb
Expand Up @@ -123,6 +123,8 @@ def test_break_ensure_def_method
assert_equal false, test_break_ensure_def_method
omit "failing due to exception entry sp mismatch"
assert_iseq_roundtrip(src)
ensure
Object.undef_method(:test_break_ensure_def_method) rescue nil
end
def test_kwarg
Expand Down
3 changes: 3 additions & 0 deletions test/ruby/test_eval.rb
Expand Up @@ -488,6 +488,9 @@ def test_define_method_toplevel
end
end
assert_equal(feature6609, feature6609_method)
ensure
Object.undef_method(:feature6609_block) rescue nil
Object.undef_method(:feature6609_method) rescue nil
end

def test_eval_using_integer_as_binding
Expand Down
2 changes: 2 additions & 0 deletions test/ruby/test_iseq.rb
Expand Up @@ -637,6 +637,8 @@ def self.foo
}

lines
ensure
Object.send(:remove_const, :A) rescue nil
end

def test_to_binary_line_tracepoint
Expand Down
2 changes: 2 additions & 0 deletions test/ruby/test_module.rb
Expand Up @@ -1728,6 +1728,8 @@ def test_nonascii_name
assert_equal("TestModule::C\u{df}", c.name, '[ruby-core:24600]')
c = Module.new.module_eval("class X\u{df} < Module; self; end")
assert_match(/::X\u{df}:/, c.new.to_s)
ensure
Object.send(:remove_const, "C\u{df}")
end


Expand Down
1 change: 1 addition & 0 deletions test/ruby/test_require.rb
Expand Up @@ -210,6 +210,7 @@ def assert_syntax_error_backtrace
assert_not_nil(bt = e.backtrace, "no backtrace")
assert_not_empty(bt.find_all {|b| b.start_with? __FILE__}, proc {bt.inspect})
end
ensure
$LOADED_FEATURES.replace loaded_features
end

Expand Down

0 comments on commit d2c6dca

Please sign in to comment.