|
2 | 2 | require_relative '../../fixtures/source_range_helpers' |
3 | 3 |
|
4 | 4 | ruby_version_is "4.1" do |
| 5 | + require_relative 'fixtures/syntax_tree' # avoids warnings on Ruby 3.3 |
| 6 | + |
5 | 7 | describe "Proc#syntax_tree" do |
6 | 8 | before :each do |
7 | 9 | skip "parse.y" unless syntax_tree_returns_prism_node |
@@ -38,26 +40,24 @@ def return_block(&b) |
38 | 40 | node.should.is_a?(Ruby::Prism::LambdaNode) |
39 | 41 | end |
40 | 42 |
|
41 | | - quarantine! do # NoMethodError: undefined method 'start_line' for nil |
42 | 43 | it "does not return implicit parameter nodes" do |
43 | 44 | # Interesting because the BlockNode and the ItParametersNode/NumberedParametersNode are fully overlapping |
44 | | - node = eval('-> { it }.syntax_tree') # emits a warning on Ruby 3.3 |
45 | | - node.start_line.should == __LINE__ - 1 |
| 45 | + node = ProcSpecs::SyntaxTree.lambda_it.syntax_tree |
| 46 | + node.start_line.should == ProcSpecs::SyntaxTree::LAMBDA_IT_LINE |
46 | 47 | node.should.is_a?(Ruby::Prism::LambdaNode) |
47 | 48 |
|
48 | 49 | node = -> { _1 }.syntax_tree |
49 | 50 | node.start_line.should == __LINE__ - 1 |
50 | 51 | node.should.is_a?(Ruby::Prism::LambdaNode) |
51 | 52 |
|
52 | | - node = eval('proc { it }.syntax_tree') # emits a warning on Ruby 3.3 |
53 | | - node.start_line.should == __LINE__ - 1 |
| 53 | + node = ProcSpecs::SyntaxTree.proc_it.syntax_tree |
| 54 | + node.start_line.should == ProcSpecs::SyntaxTree::PROC_IT_LINE |
54 | 55 | node.should.is_a?(Ruby::Prism::CallNode) |
55 | 56 |
|
56 | 57 | node = proc { _1 }.syntax_tree |
57 | 58 | node.start_line.should == __LINE__ - 1 |
58 | 59 | node.should.is_a?(Ruby::Prism::CallNode) |
59 | 60 | end |
60 | | - end |
61 | 61 |
|
62 | 62 | it "returns a ForNode for a for-loop block" do |
63 | 63 | iter = Object.new |
|
0 commit comments