diff options
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] } |
