[前][次][番号順一覧][スレッド一覧]

ruby-changes:65437

From: Jeremy <ko1@a...>
Date: Thu, 11 Mar 2021 05:11:33 +0900 (JST)
Subject: [ruby-changes:65437] d9fea496af (master): Remove cvar overtaken classes at end of test methods

https://git.ruby-lang.org/ruby.git/commit/?id=d9fea496af

From d9fea496afed5a35d2f79ea3cac35176966dd471 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Wed, 10 Mar 2021 12:09:45 -0800
Subject: Remove cvar overtaken classes at end of test methods

Fixes issues when the same tests are executed more than once,
which some CI machines do.
---
 test/ruby/test_variable.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index bedddf0..f8a7c68 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -96,6 +96,9 @@ class TestVariable < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L96
     EORB
 
     assert_equal "class variable @@cvar of TestVariable::Child is overtaken by TestVariable::Parent", error.message
+  ensure
+    TestVariable.send(:remove_const, :Child) rescue nil
+    TestVariable.send(:remove_const, :Parent) rescue nil
   end
 
   def test_cvar_overtaken_by_module
@@ -124,6 +127,9 @@ class TestVariable < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L127
     EORB
 
     assert_equal "class variable @@cvar of TestVariable::ParentForModule is overtaken by TestVariable::Mixin", error.message
+  ensure
+    TestVariable.send(:remove_const, :Mixin) rescue nil
+    TestVariable.send(:remove_const, :ParentForModule) rescue nil
   end
 
   class IncludeRefinedModuleClassVariableNoWarning
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]