diff options
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_ast.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 8de4a5bfe2..91f4250cfc 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -1424,6 +1424,20 @@ dummy assert_locations(node.children[-1].locations, [[1, 0, 1, 6], [1, 0, 1, 6]]) end + def test_splat_locations + node = ast_parse("a = *1") + assert_locations(node.children[-1].children[1].locations, [[1, 4, 1, 6], [1, 4, 1, 5]]) + + node = ast_parse("a = *1, 2") + assert_locations(node.children[-1].children[1].children[0].locations, [[1, 4, 1, 6], [1, 4, 1, 5]]) + + node = ast_parse("case a; when *1; end") + assert_locations(node.children[-1].children[1].children[0].locations, [[1, 13, 1, 15], [1, 13, 1, 14]]) + + node = ast_parse("case a; when *1, 2; end") + assert_locations(node.children[-1].children[1].children[0].children[0].locations, [[1, 13, 1, 15], [1, 13, 1, 14]]) + end + def test_unless_locations node = ast_parse("unless cond then 1 else 2 end") assert_locations(node.children[-1].locations, [[1, 0, 1, 29], [1, 0, 1, 6], [1, 12, 1, 16], [1, 26, 1, 29]]) |
