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

ruby-changes:38970

From: nobu <ko1@a...>
Date: Mon, 29 Jun 2015 01:36:17 +0900 (JST)
Subject: [ruby-changes:38970] nobu:r51051 (trunk): test_redefinition_mismatch

nobu	2015-06-29 01:35:58 +0900 (Mon, 29 Jun 2015)

  New Revision: 51051

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51051

  Log:
    test_redefinition_mismatch
    
    * test/ruby/test_{class,module}.rb (test_redefinition_mismatch):
      add tests of redefinition mismatch.

  Modified files:
    trunk/test/ruby/test_class.rb
    trunk/test/ruby/test_module.rb
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 51050)
+++ test/ruby/test_module.rb	(revision 51051)
@@ -2066,6 +2066,14 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L2066
     end
   end
 
+  def test_redefinition_mismatch
+    m = Module.new
+    m.module_eval "A = 1"
+    assert_raise_with_message(TypeError, /is not a module/) {
+      m.module_eval "module A; end"
+    }
+  end
+
   private
 
   def assert_top_method_is_private(method)
Index: test/ruby/test_class.rb
===================================================================
--- test/ruby/test_class.rb	(revision 51050)
+++ test/ruby/test_class.rb	(revision 51051)
@@ -522,4 +522,12 @@ class TestClass < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_class.rb#L522
       assert_equal(m, m.xyzzy, "Bug #10871")
     }
   end
+
+  def test_redefinition_mismatch
+    m = Module.new
+    m.module_eval "A = 1"
+    assert_raise_with_message(TypeError, /is not a class/) {
+      m.module_eval "class A; end"
+    }
+  end
 end

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

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