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

ruby-changes:41801

From: nobu <ko1@a...>
Date: Sat, 20 Feb 2016 01:53:38 +0900 (JST)
Subject: [ruby-changes:41801] nobu:r53875 (trunk): object.c: fix error message

nobu	2016-02-20 01:54:08 +0900 (Sat, 20 Feb 2016)

  New Revision: 53875

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

  Log:
    object.c: fix error message
    
    * object.c (rb_mod_const_get): make error message at uninterned
      string consistent with symbols.  [ruby-dev:49498] [Bug #12089]

  Modified files:
    trunk/ChangeLog
    trunk/object.c
    trunk/test/-ext-/symbol/test_inadvertent_creation.rb
Index: test/-ext-/symbol/test_inadvertent_creation.rb
===================================================================
--- test/-ext-/symbol/test_inadvertent_creation.rb	(revision 53874)
+++ test/-ext-/symbol/test_inadvertent_creation.rb	(revision 53875)
@@ -54,6 +54,14 @@ module Test_Symbol https://github.com/ruby/ruby/blob/trunk/test/-ext-/symbol/test_inadvertent_creation.rb#L54
       assert_not_interned_error(cl, :const_get, name.to_sym)
     end
 
+    def test_module_const_get_toplevel
+      bug12089 = '[ruby-dev:49498] [Bug #12089]'
+      name = noninterned_name("A")
+      e = assert_not_interned_error(Object, :const_get, name)
+      assert_equal(name, e.name)
+      assert_not_match(/Object::/, e.message, bug12089)
+    end
+
     def test_module_const_defined?
       cl = Class.new
       name = noninterned_name("A")
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53874)
+++ ChangeLog	(revision 53875)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Feb 20 01:53:33 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* object.c (rb_mod_const_get): make error message at uninterned
+	  string consistent with symbols.  [ruby-dev:49498] [Bug #12089]
+
 Fri Feb 19 23:37:52 2016  Masahiro Tomita  <tommy@t...>
 
 	* lib/find.rb (Find#find): raise with the given path name if it
Index: object.c
===================================================================
--- object.c	(revision 53874)
+++ object.c	(revision 53875)
@@ -2139,7 +2139,7 @@ rb_mod_const_get(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/object.c#L2139
 		continue;
 	    }
 	    else {
-		rb_name_err_raise("uninitialized constant %2$s::%1$s", mod, part);
+		rb_mod_const_missing(mod, part);
 	    }
 	}
 	if (!rb_is_const_id(id)) {

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

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