@@ -680,7 +680,7 @@ def test_find_body_document_method
680680
681681 baz = methods . last
682682 assert_equal 'Foo#baz' , baz . full_name
683- assert_equal "a comment for bar" , bar . comment
683+ assert_equal "a comment for bar" , baz . comment
684684 end
685685
686686 def test_find_modifiers_call_seq
@@ -911,6 +911,37 @@ def test_define_method
911911{
912912}
913913
914+ void
915+ Init_IO(void) {
916+ /*
917+ * a comment for class Foo on rb_define_class
918+ */
919+ VALUE rb_cIO = rb_define_class("IO", rb_cObject);
920+ rb_define_singleton_method(rb_cIO, "read", rb_io_s_read, -1);
921+ }
922+ EOF
923+
924+ klass = util_get_class content , 'rb_cIO'
925+ read_method = klass . method_list . first
926+ assert_equal "read" , read_method . name
927+ assert_equal "Method Comment! " , read_method . comment
928+ assert_equal "rb_io_s_read" , read_method . c_function
929+ assert read_method . singleton
930+ end
931+
932+ def test_define_method_with_prototype
933+ content = <<-EOF
934+ static VALUE rb_io_s_read(int, VALUE*, VALUE);
935+
936+ /*Method Comment! */
937+ static VALUE
938+ rb_io_s_read(argc, argv, io)
939+ int argc;
940+ VALUE *argv;
941+ VALUE io;
942+ {
943+ }
944+
914945void
915946Init_IO(void) {
916947 /*
0 commit comments