Skip to content

Commit bf49394

Browse files
committed
Add test_parse_statements_method_oneliner_with_regexp
1 parent d751e31 commit bf49394

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_rdoc_parser_ruby.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,28 @@ def blah()
24992499
assert_equal markup_code, expected
25002500
end
25012501

2502+
def test_parse_statements_method_oneliner_with_regexp
2503+
util_parser <<RUBY
2504+
class Foo
2505+
def blah() /bar/ end
2506+
end
2507+
RUBY
2508+
2509+
expected = <<EXPTECTED
2510+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">blah</span>() <span class="ruby-regexp">/bar/</span> <span class="ruby-keyword">end</span>
2511+
EXPTECTED
2512+
expected = expected.rstrip
2513+
2514+
@parser.scan
2515+
2516+
foo = @top_level.classes.first
2517+
assert_equal 'Foo', foo.full_name
2518+
2519+
blah = foo.method_list.first
2520+
markup_code = blah.markup_code.sub(/^.*\n/, '')
2521+
assert_equal expected, markup_code
2522+
end
2523+
25022524
def test_parse_require_dynamic_string
25032525
content = <<-RUBY
25042526
prefix = 'path'

0 commit comments

Comments
 (0)