66# Needs Prism.parse_file(file, version: "current")
77return if RUBY_VERSION < "3.3"
88
9+ require_relative 'inline_method'
10+
911module Prism
1012 class NodeForTest < TestCase
1113 INDENT = ' ' * 4
@@ -15,13 +17,12 @@ def m(foo)
1517 end
1618 M_LOCATION = [ __LINE__ -3 , 4 , __LINE__ -1 , 7 ]
1719
18- def inline_method = 42
19- INLINE_LOCATION = [ __LINE__ -1 , 4 , __LINE__ -1 , 26 ]
20-
2120 define_method ( :define_method_method ) { 42 }
2221 DEFINE_METHOD_LOCATION = [ __LINE__ -1 , 41 , __LINE__ -1 , 47 ]
2322
24- def return_block ( &block ) = block
23+ def return_block ( &block )
24+ block
25+ end
2526
2627 def with_location ( callable , locs , file = __FILE__ )
2728 source_location = [ file , *locs ]
@@ -44,7 +45,7 @@ def test_def_method
4445 end
4546
4647 def test_inline_method
47- node = Prism . node_for ( with_location ( method ( :inline_method ) , INLINE_LOCATION ) )
48+ node = Prism . node_for ( with_location ( method ( :inline_method ) , * INLINE_LOCATION_AND_FILE ) )
4849 assert_instance_of ( Prism ::DefNode , node )
4950 assert_equal "def inline_method = 42" , node . slice
5051 end
@@ -89,7 +90,7 @@ def test_proc
8990 end
9091
9192 def test_method_to_proc
92- node = Prism . node_for ( with_location ( method ( :inline_method ) . to_proc , INLINE_LOCATION ) )
93+ node = Prism . node_for ( with_location ( method ( :inline_method ) . to_proc , * INLINE_LOCATION_AND_FILE ) )
9394 assert_instance_of ( Prism ::DefNode , node )
9495 assert_equal "def inline_method = 42" , node . slice
9596 end
0 commit comments