diff options
| author | ydah <t.yudai92@gmail.com> | 2024-09-05 18:41:10 +0900 |
|---|---|---|
| committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2024-09-09 10:34:02 +0900 |
| commit | d52e599538fb67535c95d86aec89fd7e53c61818 (patch) | |
| tree | fcb0fd4bbd8a9db6a598a135a0f0a62f2178ed5d /test/ruby | |
| parent | b5f12910151f93f5f14057c52ffffa2b2ef09caa (diff) | |
Implement WHEN NODE locations
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11553
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_ast.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index f03a323ccf..8ecd384d58 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -1375,6 +1375,11 @@ dummy assert_locations(node.children[-1].locations, [[1, 0, 1, 13], [1, 0, 1, 5]]) end + def test_when_locations + node = RubyVM::AbstractSyntaxTree.parse("case a; when 1 then 2; end") + assert_locations(node.children[-1].children[1].locations, [[1, 8, 1, 22], [1, 8, 1, 12], [1, 15, 1, 19]]) + end + private def assert_locations(locations, expected) ary = locations.map {|loc| loc && [loc.first_lineno, loc.first_column, loc.last_lineno, loc.last_column] } |
