[ruby/prism] Location#slice_lines, Node#slice_lines

9b61f6fdb3
This commit is contained in:
Kevin Newton 2024-04-26 14:55:49 -04:00 committed by git
parent 0599184a18
commit 9688093124
3 changed files with 29 additions and 0 deletions

View file

@ -209,6 +209,13 @@ module Prism
assert_equal "", location.slice
end
def test_location_slice_lines
result = Prism.parse("\nprivate def foo\nend\n")
method = result.value.statements.body.first.arguments.arguments.first
assert_equal "private def foo\nend\n", method.slice_lines
end
def test_heredoc?
refute parse_expression("\"foo\"").heredoc?
refute parse_expression("\"foo \#{1}\"").heredoc?