aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_parser_c.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/test_rdoc_parser_c.rb')
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb36
1 files changed, 26 insertions, 10 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index 9649933fd0..45d0b1e341 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -236,27 +236,43 @@ VALUE cFoo = rb_define_class("Foo", rb_cObject);
assert_equal "this is the Foo class", klass.comment
end
- def test_do_classes_singleton
+ def test_do_classes_class_under
content = <<-EOF
-VALUE cFoo = rb_define_class("Foo", rb_cObject);
-VALUE cFooS = rb_singleton_class(cFoo);
+/* Document-class: Kernel::Foo
+ * this is the Foo class under Kernel
+ */
+VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject);
EOF
- util_get_class content, 'cFooS'
-
- assert_equal 'Foo', @parser.singleton_classes['cFooS']
+ klass = util_get_class content, 'cFoo'
+ assert_equal 'Kernel::Foo', klass.full_name
+ assert_equal "this is the Foo class under Kernel", klass.comment
end
- def test_do_classes_class_under
+ def test_do_classes_class_under_rb_path2class
content = <<-EOF
/* Document-class: Kernel::Foo
- * this is the Foo class under Kernel
+ * this is Kernel::Foo < A::B
*/
-VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject);
+VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_path2class("A::B"));
EOF
klass = util_get_class content, 'cFoo'
- assert_equal "this is the Foo class under Kernel", klass.comment
+
+ assert_equal 'Kernel::Foo', klass.full_name
+ assert_equal 'A::B', klass.superclass
+ assert_equal 'this is Kernel::Foo < A::B', klass.comment
+ end
+
+ def test_do_classes_singleton
+ content = <<-EOF
+VALUE cFoo = rb_define_class("Foo", rb_cObject);
+VALUE cFooS = rb_singleton_class(cFoo);
+ EOF
+
+ util_get_class content, 'cFooS'
+
+ assert_equal 'Foo', @parser.singleton_classes['cFooS']
end
def test_do_classes_module