summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorydah <t.yudai92@gmail.com>2024-11-03 00:47:19 +0900
committerYudai Takada <t.yudai92@gmail.com>2025-01-04 20:27:40 +0900
commit24653430cde5f7abb895d1a009ebf4d8cfc39519 (patch)
tree98c771b7aa882d31709cb1b09bb54d3d96561878 /test/ruby
parent61c4907458f00841f28feb2daeb508af8c494d51 (diff)
Implement FLIP2 NODE locations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11986
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index b7bad396b0..cb48efb75a 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1412,6 +1412,14 @@ dummy
assert_locations(node.children[-1].children[1].locations, [[1, 0, 1, 5], [1, 1, 1, 2], nil])
end
+ def test_flip2_locations
+ node = ast_parse("if 'a'..'z'; foo; end")
+ assert_locations(node.children[-1].children[0].locations, [[1, 3, 1, 11], [1, 6, 1, 8]])
+
+ node = ast_parse('if 1..5; foo; end')
+ assert_locations(node.children[-1].children[0].locations, [[1, 3, 1, 7], [1, 4, 1, 6]])
+ end
+
def test_lambda_locations
node = ast_parse("-> (a, b) { foo }")
assert_locations(node.children[-1].locations, [[1, 0, 1, 17], [1, 0, 1, 2], [1, 10, 1, 11], [1, 16, 1, 17]])