From 347e748bddd42e5a39dcb5c55ac37704a14b9374 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 19 Oct 2013 20:24:30 +0000 Subject: variable.c: real class name * variable.c (rb_class2name): should return real class name, not singleton class or iclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/-ext-/class/test_class2name.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/-ext-/class/test_class2name.rb (limited to 'test/-ext-') diff --git a/test/-ext-/class/test_class2name.rb b/test/-ext-/class/test_class2name.rb new file mode 100644 index 0000000000..070be5a130 --- /dev/null +++ b/test/-ext-/class/test_class2name.rb @@ -0,0 +1,18 @@ +require 'test/unit' +require "-test-/class" + +class Test_Class < Test::Unit::TestCase + class Test_Class2Name < superclass + def test_toplevel_class + assert_equal("Object", Bug::Class.class2name(::Object)) + end + + def test_toplevel_module + assert_equal("Kernel", Bug::Class.class2name(::Kernel)) + end + + def test_singleton_class + assert_equal("Object", Bug::Class.class2name(::Object.new.singleton_class)) + end + end +end -- cgit v1.2.3