summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-09-15 11:13:11 -0400
committergit <svn-admin@ruby-lang.org>2023-09-15 22:24:25 +0000
commitffe77c022ca02717576b9d272c43baf8ec81083d (patch)
treed1d9f111ae2c0f844b4383c4f47289a09569da35 /test
parentbbf9f11ce610cad35e076e5c647815dd3e1a4949 (diff)
[ruby/yarp] Handle infinite opt terms after missing case predicate
https://github.com/ruby/yarp/commit/d931e258d1
Diffstat (limited to 'test')
-rw-r--r--test/yarp/fixtures/case.txt2
-rw-r--r--test/yarp/snapshots/case.txt70
2 files changed, 43 insertions, 29 deletions
diff --git a/test/yarp/fixtures/case.txt b/test/yarp/fixtures/case.txt
index 76d11313ee..1b720bc5ac 100644
--- a/test/yarp/fixtures/case.txt
+++ b/test/yarp/fixtures/case.txt
@@ -28,3 +28,5 @@ case type;
;when :b;
; else;
end
+
+case ;;;;;;;; when 1; end
diff --git a/test/yarp/snapshots/case.txt b/test/yarp/snapshots/case.txt
index 0929f7c3d2..9e5b20aac8 100644
--- a/test/yarp/snapshots/case.txt
+++ b/test/yarp/snapshots/case.txt
@@ -1,8 +1,8 @@
-@ ProgramNode (location: (0...272))
+@ ProgramNode (location: (0...299))
├── locals: []
└── statements:
- @ StatementsNode (location: (0...272))
- └── body: (length: 8)
+ @ StatementsNode (location: (0...299))
+ └── body: (length: 9)
├── @ CaseNode (location: (0...21))
│ ├── predicate:
│ │ @ SymbolNode (location: (5...8))
@@ -222,32 +222,44 @@
│ │ └── end_keyword_loc: (227...230) = "end"
│ ├── case_keyword_loc: (200...204) = "case"
│ └── end_keyword_loc: (227...230) = "end"
- └── @ CaseNode (location: (232...272))
- ├── predicate:
- │ @ CallNode (location: (237...241))
- │ ├── receiver: ∅
- │ ├── call_operator_loc: ∅
- │ ├── message_loc: (237...241) = "type"
- │ ├── opening_loc: ∅
- │ ├── arguments: ∅
- │ ├── closing_loc: ∅
- │ ├── block: ∅
- │ ├── flags: variable_call
- │ └── name: "type"
+ ├── @ CaseNode (location: (232...272))
+ │ ├── predicate:
+ │ │ @ CallNode (location: (237...241))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (237...241) = "type"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "type"
+ │ ├── conditions: (length: 1)
+ │ │ └── @ WhenNode (location: (246...253))
+ │ │ ├── keyword_loc: (246...250) = "when"
+ │ │ ├── conditions: (length: 1)
+ │ │ │ └── @ SymbolNode (location: (251...253))
+ │ │ │ ├── opening_loc: (251...252) = ":"
+ │ │ │ ├── value_loc: (252...253) = "b"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "b"
+ │ │ └── statements: ∅
+ │ ├── consequent:
+ │ │ @ ElseNode (location: (260...272))
+ │ │ ├── else_keyword_loc: (260...264) = "else"
+ │ │ ├── statements: ∅
+ │ │ └── end_keyword_loc: (269...272) = "end"
+ │ ├── case_keyword_loc: (232...236) = "case"
+ │ └── end_keyword_loc: (269...272) = "end"
+ └── @ CaseNode (location: (274...299))
+ ├── predicate: ∅
├── conditions: (length: 1)
- │ └── @ WhenNode (location: (246...253))
- │ ├── keyword_loc: (246...250) = "when"
+ │ └── @ WhenNode (location: (288...294))
+ │ ├── keyword_loc: (288...292) = "when"
│ ├── conditions: (length: 1)
- │ │ └── @ SymbolNode (location: (251...253))
- │ │ ├── opening_loc: (251...252) = ":"
- │ │ ├── value_loc: (252...253) = "b"
- │ │ ├── closing_loc: ∅
- │ │ └── unescaped: "b"
+ │ │ └── @ IntegerNode (location: (293...294))
+ │ │ └── flags: decimal
│ └── statements: ∅
- ├── consequent:
- │ @ ElseNode (location: (260...272))
- │ ├── else_keyword_loc: (260...264) = "else"
- │ ├── statements: ∅
- │ └── end_keyword_loc: (269...272) = "end"
- ├── case_keyword_loc: (232...236) = "case"
- └── end_keyword_loc: (269...272) = "end"
+ ├── consequent: ∅
+ ├── case_keyword_loc: (274...278) = "case"
+ └── end_keyword_loc: (296...299) = "end"