summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-04-26 14:55:49 -0400
committergit <svn-admin@ruby-lang.org>2024-04-26 19:05:32 +0000
commit96880931244513b35846db9f0b811a5db473f989 (patch)
treec3f3e5ab225dd1e06d3e217f5fa3c77ed2303454 /test
parent0599184a18026c9a5a189c93c1cd6c9c6d23b4ad (diff)
[ruby/prism] Location#slice_lines, Node#slice_lines
https://github.com/ruby/prism/commit/9b61f6fdb3
Diffstat (limited to 'test')
-rw-r--r--test/prism/ruby_api_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/prism/ruby_api_test.rb b/test/prism/ruby_api_test.rb
index bf493666d2..9e408d1edd 100644
--- a/test/prism/ruby_api_test.rb
+++ b/test/prism/ruby_api_test.rb
@@ -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?