summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorydah <t.yudai92@gmail.com>2024-11-03 00:31:29 +0900
committerYudai Takada <t.yudai92@gmail.com>2025-01-04 20:27:40 +0900
commit61c4907458f00841f28feb2daeb508af8c494d51 (patch)
tree7a3f9bb20193711d45070c2898e54c3126578a0e /test/ruby
parent88da6856a3f5cc6a84a8d1909f56952c605ef0dc (diff)
Implement DOT3 NODE locations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11986
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 0e8f422193..b7bad396b0 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1390,6 +1390,20 @@ dummy
assert_locations(node.children[-1].children[-1].children[0].locations, [[1, 4, 1, 7], [1, 4, 1, 6]])
end
+ def test_dot3_locations
+ node = ast_parse("1...2")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 5], [1, 1, 1, 4]])
+
+ node = ast_parse("foo(1...2)")
+ assert_locations(node.children[-1].children[-1].children[0].locations, [[1, 4, 1, 9], [1, 5, 1, 8]])
+
+ node = ast_parse("foo(1...2, 3)")
+ assert_locations(node.children[-1].children[-1].children[0].locations, [[1, 4, 1, 9], [1, 5, 1, 8]])
+
+ node = ast_parse("foo(...2)")
+ assert_locations(node.children[-1].children[-1].children[0].locations, [[1, 4, 1, 8], [1, 4, 1, 7]])
+ end
+
def test_evstr_locations
node = ast_parse('"#{foo}"')
assert_locations(node.children[-1].children[1].locations, [[1, 0, 1, 8], [1, 1, 1, 3], [1, 6, 1, 7]])