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

ruby-changes:52287

From: kazu <ko1@a...>
Date: Tue, 21 Aug 2018 23:58:01 +0900 (JST)
Subject: [ruby-changes:52287] kazu:r64495 (trunk): Add more assertions for NotImplementedError of instance method

kazu	2018-08-21 23:57:56 +0900 (Tue, 21 Aug 2018)

  New Revision: 64495

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

  Log:
    Add more assertions for NotImplementedError of instance method

  Modified files:
    trunk/ext/-test-/notimplement/bug.c
    trunk/test/-ext-/test_notimplement.rb
Index: ext/-test-/notimplement/bug.c
===================================================================
--- ext/-test-/notimplement/bug.c	(revision 64494)
+++ ext/-test-/notimplement/bug.c	(revision 64495)
@@ -11,7 +11,7 @@ void https://github.com/ruby/ruby/blob/trunk/ext/-test-/notimplement/bug.c#L11
 Init_notimplement(void)
 {
     VALUE mBug = rb_define_module("Bug");
-    VALUE klass = rb_define_module_under(mBug, "NotImplement");
+    VALUE klass = rb_define_class_under(mBug, "NotImplement", rb_cObject);
     rb_define_module_function(mBug, "funcall", bug_funcall, -1);
     rb_define_module_function(mBug, "notimplement", rb_f_notimplement, -1);
     rb_define_method(klass, "notimplement", rb_f_notimplement, -1);
Index: test/-ext-/test_notimplement.rb
===================================================================
--- test/-ext-/test_notimplement.rb	(revision 64494)
+++ test/-ext-/test_notimplement.rb	(revision 64495)
@@ -7,10 +7,14 @@ class Test_NotImplement < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/-ext-/test_notimplement.rb#L7
     assert_raise(NotImplementedError, bug3662) {
       Bug.funcall(:notimplement)
     }
+    assert_raise(NotImplementedError) {
+      Bug::NotImplement.new.notimplement
+    }
   end
 
   def test_respond_to
     assert_not_respond_to(Bug, :notimplement)
+    assert_not_respond_to(Bug::NotImplement.new, :notimplement)
   end
 
   def test_not_method_defined

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

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