From 8603c5934a4e613cdb07b04a1ce86fb1f21fdbd5 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 26 Jul 2011 16:05:35 +0000 Subject: * eval_error.c (rb_print_undef_str): new function to raise NameError for undefined method. * load.c (rb_mod_autoload_p), object.c (rb_mod_const_get), variable.c (rb_f_untrace_var, set_const_visibility), vm_method.c (rb_mod_{remove,undef,alias}_method, set_method_visibility): remove inadvertent symbol creation. based on the first patch by Jeremy Evans at [ruby-core:38447]. [Feature #5089] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_module.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby/test_module.rb') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index b6e827a944..e2680dd700 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -472,6 +472,9 @@ class TestModule < Test::Unit::TestCase assert_raise(NameError) { c2::Bar } assert_raise(NameError) { c2.const_get(:Bar) } assert_raise(NameError) { c2.const_get(:Bar, false) } + assert_raise(NameError) { c2.const_get("Bar", false) } + assert_raise(NameError) { c2.const_get("BaR11", false) } + assert_raise(NameError) { Object.const_get("BaR11", false) } c1.instance_eval do def const_missing(x) @@ -483,6 +486,11 @@ class TestModule < Test::Unit::TestCase assert_equal(:Bar, c2::Bar) assert_equal(:Bar, c2.const_get(:Bar)) assert_equal(:Bar, c2.const_get(:Bar, false)) + assert_equal(:Bar, c2.const_get("Bar")) + assert_equal(:Bar, c2.const_get("Bar", false)) + + v = c2.const_get("Bar11", false) + assert_equal("Bar11".to_sym, v) assert_raise(NameError) { c1.const_get(:foo) } end -- cgit v1.2.3