Skip to content

Remove unnecessary condition of RDoc::TokenStream.to_html #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/rdoc/token_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ def self.to_html token_stream
when :on_ivar then 'ruby-ivar'
when :on_cvar then 'ruby-identifier'
when :on_gvar then 'ruby-identifier'
when '=' != t[:text] && :on_op then
if RDoc::RipperStateLex::EXPR_ARG == t[:state] then
'ruby-identifier'
else
'ruby-operator'
end
when '=' != t[:text] && :on_op
then 'ruby-operator'
when :on_tlambda then 'ruby-operator'
when :on_ident then 'ruby-identifier'
when :on_label then 'ruby-value'
Expand Down
23 changes: 23 additions & 0 deletions test/test_rdoc_parser_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,29 @@ def blah()
assert_equal expected, markup_code
end

def test_parse_instance_operation_method
util_parser <<-RUBY
class Foo
def self.& end
end
RUBY

expected = <<EXPECTED
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">&amp;</span> <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
EXPECTED
expected = expected.rstrip

@parser.scan

foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name

blah = foo.method_list.first
markup_code = blah.markup_code.sub(/^.*\n/, '')
assert_equal expected, markup_code
end

def test_parse_statements_postfix_if_after_heredocbeg
@filename = 'file.rb'
util_parser <<RUBY
Expand Down