diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/yarp/location_test.rb | 8 | ||||
| -rw-r--r-- | test/yarp/snapshots/unparser/corpus/literal/if.txt | 2 | ||||
| -rw-r--r-- | test/yarp/snapshots/whitequark/cond_match_current_line.txt | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/test/yarp/location_test.rb b/test/yarp/location_test.rb index 6b219a0b36..46cae55cac 100644 --- a/test/yarp/location_test.rb +++ b/test/yarp/location_test.rb @@ -450,6 +450,10 @@ module YARP assert_location(IntegerNode, "0o1_000") end + def test_InterpolatedMatchLastLineNode + assert_location(InterpolatedMatchLastLineNode, "if /foo \#{bar}/ then end", 3...15, &:predicate) + end + def test_InterpolatedRegularExpressionNode assert_location(InterpolatedRegularExpressionNode, "/\#{foo}/") end @@ -525,6 +529,10 @@ module YARP assert_location(LocalVariableWriteNode, "foo = bar") end + def test_MatchLastLineNode + assert_location(MatchLastLineNode, "if /foo/ then end", 3...8, &:predicate) + end + def test_MatchPredicateNode assert_location(MatchPredicateNode, "foo in bar") end diff --git a/test/yarp/snapshots/unparser/corpus/literal/if.txt b/test/yarp/snapshots/unparser/corpus/literal/if.txt index 88cc011900..4a439644b0 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/if.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/if.txt @@ -6,7 +6,7 @@ ├── @ IfNode (location: (0...18)) │ ├── if_keyword_loc: (0...2) = "if" │ ├── predicate: - │ │ @ RegularExpressionNode (location: (3...8)) + │ │ @ MatchLastLineNode (location: (3...8)) │ │ ├── opening_loc: (3...4) = "/" │ │ ├── content_loc: (4...7) = "foo" │ │ ├── closing_loc: (7...8) = "/" diff --git a/test/yarp/snapshots/whitequark/cond_match_current_line.txt b/test/yarp/snapshots/whitequark/cond_match_current_line.txt index e5902bce8f..88e35d7ca0 100644 --- a/test/yarp/snapshots/whitequark/cond_match_current_line.txt +++ b/test/yarp/snapshots/whitequark/cond_match_current_line.txt @@ -5,7 +5,7 @@ └── body: (length: 2) ├── @ CallNode (location: (0...6)) │ ├── receiver: - │ │ @ RegularExpressionNode (location: (1...6)) + │ │ @ MatchLastLineNode (location: (1...6)) │ │ ├── opening_loc: (1...2) = "/" │ │ ├── content_loc: (2...5) = "wat" │ │ ├── closing_loc: (5...6) = "/" @@ -22,7 +22,7 @@ └── @ IfNode (location: (8...21)) ├── if_keyword_loc: (8...10) = "if" ├── predicate: - │ @ RegularExpressionNode (location: (11...16)) + │ @ MatchLastLineNode (location: (11...16)) │ ├── opening_loc: (11...12) = "/" │ ├── content_loc: (12...15) = "wat" │ ├── closing_loc: (15...16) = "/" |
