summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-19 20:24:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-19 20:24:30 +0000
commit347e748bddd42e5a39dcb5c55ac37704a14b9374 (patch)
tree33aa9f1624bf85f20fb49336e24bd5ee279f7545 /test/-ext-
parentddbee25a3b6c9385880c29efe936906646b58ca4 (diff)
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
Diffstat (limited to 'test/-ext-')
-rw-r--r--test/-ext-/class/test_class2name.rb18
1 files changed, 18 insertions, 0 deletions
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