diff options
Diffstat (limited to 'test/ruby/test_ast.rb')
-rw-r--r-- | test/ruby/test_ast.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index aaf626e801..0932e93d5a 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -186,6 +186,19 @@ class TestAst < Test::Unit::TestCase end end + def test_node_id_for_location + exception = begin + raise + rescue => e + e + end + loc = exception.backtrace_locations.first + node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(loc) + node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true) + + assert_equal node.node_id, node_id + end + def test_of_proc_and_method proc = Proc.new { 1 + 2 } method = self.method(__method__) |