From d52e599538fb67535c95d86aec89fd7e53c61818 Mon Sep 17 00:00:00 2001 From: ydah Date: Thu, 5 Sep 2024 18:41:10 +0900 Subject: Implement WHEN NODE locations --- test/ruby/test_ast.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') 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] } -- cgit v1.2.3