summaryrefslogtreecommitdiff
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.rb44
1 files changed, 38 insertions, 6 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index b65561b2bb..ab4f149869 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -460,7 +460,7 @@ VALUE mFoo = rb_define_module_under(rb_mKernel, "Foo");
end
def test_do_constants
- content = <<-EOF
+ content = <<-'EOF'
#include <ruby.h>
void Init_foo(){
@@ -475,6 +475,9 @@ void Init_foo(){
/* TEST\:TEST: Checking to see if escaped colon works */
rb_define_const(cFoo, "TEST", rb_str_new2("TEST:TEST"));
+ /* TEST: TEST:Checking to see if only word-ending colon works */
+ rb_define_const(cFoo, "TEST2", rb_str_new2("TEST:TEST"));
+
/* \\: The file separator on MS Windows */
rb_define_const(cFoo, "MSEPARATOR", rb_str_new2("\\"));
@@ -538,6 +541,9 @@ void Init_foo(){
assert_equal ['TEST', 'TEST:TEST',
'Checking to see if escaped colon works '],
constants.shift
+ assert_equal ['TEST2', 'TEST',
+ 'TEST:Checking to see if only word-ending colon works '],
+ constants.shift
assert_equal ['MSEPARATOR', '\\',
'The file separator on MS Windows '],
constants.shift
@@ -577,8 +583,6 @@ void Init_curses(){
mCurses = rb_define_module("Curses");
/*
- * Document-const: Curses::COLOR_BLACK
- *
* Value of the color black
*/
rb_curses_define_const(COLOR_BLACK);
@@ -603,8 +607,7 @@ void Init_curses(){
def test_do_constants_file
content = <<-EOF
void Init_File(void) {
- /* Document-const: LOCK_SH
- *
+ /*
* Shared lock
*/
rb_file_const("LOCK_SH", INT2FIX(LOCK_SH));
@@ -1373,6 +1376,36 @@ Init_Foo(void) {
assert_equal "DLL_LOCAL VALUE\nother_function() {\n}", code
end
+ def test_find_body_static_inline
+ content = <<-EOF
+/*
+ * a comment for other_function
+ */
+static inline VALUE
+other_function() {
+}
+
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+
+ rb_define_method(foo, "my_method", other_function, 0);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+ other_function = klass.method_list.first
+
+ assert_equal 'my_method', other_function.name
+ assert_equal "a comment for other_function",
+ other_function.comment.text
+ assert_equal '()', other_function.params
+
+ code = other_function.token_stream.first[:text]
+
+ assert_equal "static inline VALUE\nother_function() {\n}", code
+ end
+
def test_find_modifiers_call_seq
comment = RDoc::Comment.new <<-COMMENT
call-seq:
@@ -2068,4 +2101,3 @@ void Init_Blah(void) {
end
end
-