Skip to content

Commit

Permalink
Add spec for single-line methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed Dec 26, 2020
1 parent fb2c885 commit 1518c0e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/parser/ruby/ruby_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -539,5 +539,16 @@ class B
is_expected.to eq "#{condition_type} condition?; 42; end"
end
end

it "handles single-line method declaration syntax" do
YARD.parse_string <<-eof
class A
# Adds two numbers
def add(x) = x + 1
end
eof

expect(Registry.at('A#add').docstring).to eq('Adds two numbers')
end if RUBY_VERSION >= '3.'
end
end if HAVE_RIPPER

0 comments on commit 1518c0e

Please sign in to comment.