Ruby: Add additonal tests with operators at the start of lines

This commit is contained in:
Simon Friis Vindum
2026-02-12 12:30:12 +01:00
parent a27d20dbcd
commit 218585b52a
12 changed files with 799 additions and 450 deletions

View File

@@ -24,7 +24,14 @@ conditionalExprs
| conditionals.rb:67:1:70:3 | if ... | IfExpr | conditionals.rb:67:4:67:8 | ... > ... | conditionals.rb:68:1:69:5 | else ... | false |
| conditionals.rb:73:1:75:3 | if ... | IfExpr | conditionals.rb:73:4:73:9 | ... && ... | conditionals.rb:73:11:74:5 | then ... | true |
| conditionals.rb:78:1:82:3 | if ... | IfExpr | conditionals.rb:78:4:79:8 | ... && ... | conditionals.rb:79:9:81:5 | then ... | true |
| conditionals.rb:85:1:89:3 | if ... | IfExpr | conditionals.rb:85:4:86:5 | ... && ... | conditionals.rb:86:6:88:5 | then ... | true |
| conditionals.rb:86:1:90:3 | if ... | IfExpr | conditionals.rb:86:4:86:4 | a | conditionals.rb:86:5:89:5 | then ... | true |
| conditionals.rb:94:1:98:3 | if ... | IfExpr | conditionals.rb:94:4:94:4 | a | conditionals.rb:94:5:97:5 | then ... | true |
| conditionals.rb:102:1:106:3 | if ... | IfExpr | conditionals.rb:102:4:102:4 | a | conditionals.rb:102:5:105:5 | then ... | true |
| conditionals.rb:109:1:114:3 | if ... | IfExpr | conditionals.rb:109:4:111:8 | ... && ... | conditionals.rb:111:9:113:5 | then ... | true |
| conditionals.rb:118:1:123:3 | if ... | IfExpr | conditionals.rb:118:4:119:6 | ... && ... | conditionals.rb:119:7:122:5 | then ... | true |
| conditionals.rb:127:1:132:3 | if ... | IfExpr | conditionals.rb:127:4:129:7 | ... && ... | conditionals.rb:129:8:131:5 | then ... | true |
| conditionals.rb:136:1:141:3 | if ... | IfExpr | conditionals.rb:136:4:136:4 | a | conditionals.rb:136:5:140:5 | then ... | true |
| conditionals.rb:144:1:148:3 | if ... | IfExpr | conditionals.rb:144:4:145:5 | ... && ... | conditionals.rb:145:6:147:5 | then ... | true |
| loops.rb:9:5:9:5 | if ... | IfExpr | loops.rb:9:5:9:5 | ! ... | loops.rb:9:5:9:5 | ... = ... | true |
| loops.rb:16:5:16:5 | if ... | IfExpr | loops.rb:16:5:16:5 | ! ... | loops.rb:16:5:16:5 | ... = ... | true |
| loops.rb:22:5:22:7 | if ... | IfExpr | loops.rb:22:5:22:7 | ! ... | loops.rb:22:5:22:7 | ... = ... | true |
@@ -43,7 +50,14 @@ ifExprs
| conditionals.rb:67:1:70:3 | if ... | IfExpr | conditionals.rb:67:4:67:8 | ... > ... | conditionals.rb:67:10:67:13 | then ... | else ... | false |
| conditionals.rb:73:1:75:3 | if ... | IfExpr | conditionals.rb:73:4:73:9 | ... && ... | conditionals.rb:73:11:74:5 | then ... | (none) | false |
| conditionals.rb:78:1:82:3 | if ... | IfExpr | conditionals.rb:78:4:79:8 | ... && ... | conditionals.rb:79:9:81:5 | then ... | (none) | false |
| conditionals.rb:85:1:89:3 | if ... | IfExpr | conditionals.rb:85:4:86:5 | ... && ... | conditionals.rb:86:6:88:5 | then ... | (none) | false |
| conditionals.rb:86:1:90:3 | if ... | IfExpr | conditionals.rb:86:4:86:4 | a | conditionals.rb:86:5:89:5 | then ... | (none) | false |
| conditionals.rb:94:1:98:3 | if ... | IfExpr | conditionals.rb:94:4:94:4 | a | conditionals.rb:94:5:97:5 | then ... | (none) | false |
| conditionals.rb:102:1:106:3 | if ... | IfExpr | conditionals.rb:102:4:102:4 | a | conditionals.rb:102:5:105:5 | then ... | (none) | false |
| conditionals.rb:109:1:114:3 | if ... | IfExpr | conditionals.rb:109:4:111:8 | ... && ... | conditionals.rb:111:9:113:5 | then ... | (none) | false |
| conditionals.rb:118:1:123:3 | if ... | IfExpr | conditionals.rb:118:4:119:6 | ... && ... | conditionals.rb:119:7:122:5 | then ... | (none) | false |
| conditionals.rb:127:1:132:3 | if ... | IfExpr | conditionals.rb:127:4:129:7 | ... && ... | conditionals.rb:129:8:131:5 | then ... | (none) | false |
| conditionals.rb:136:1:141:3 | if ... | IfExpr | conditionals.rb:136:4:136:4 | a | conditionals.rb:136:5:140:5 | then ... | (none) | false |
| conditionals.rb:144:1:148:3 | if ... | IfExpr | conditionals.rb:144:4:145:5 | ... && ... | conditionals.rb:145:6:147:5 | then ... | (none) | false |
unlessExprs
| conditionals.rb:40:1:42:3 | unless ... | UnlessExpr | conditionals.rb:40:8:40:12 | ... > ... | conditionals.rb:40:14:41:5 | then ... | (none) |
| conditionals.rb:45:1:49:3 | unless ... | UnlessExpr | conditionals.rb:45:8:45:13 | ... == ... | conditionals.rb:45:14:46:5 | then ... | else ... |

View File

@@ -30,7 +30,14 @@
| conditionals.rb:67:1:70:3 | if ... | IfExpr |
| conditionals.rb:73:1:75:3 | if ... | IfExpr |
| conditionals.rb:78:1:82:3 | if ... | IfExpr |
| conditionals.rb:85:1:89:3 | if ... | IfExpr |
| conditionals.rb:86:1:90:3 | if ... | IfExpr |
| conditionals.rb:94:1:98:3 | if ... | IfExpr |
| conditionals.rb:102:1:106:3 | if ... | IfExpr |
| conditionals.rb:109:1:114:3 | if ... | IfExpr |
| conditionals.rb:118:1:123:3 | if ... | IfExpr |
| conditionals.rb:127:1:132:3 | if ... | IfExpr |
| conditionals.rb:136:1:141:3 | if ... | IfExpr |
| conditionals.rb:144:1:148:3 | if ... | IfExpr |
| loops.rb:9:1:12:3 | for ... in ... | ForExpr |
| loops.rb:9:5:9:5 | if ... | IfExpr |
| loops.rb:16:1:19:3 | for ... in ... | ForExpr |

View File

@@ -69,18 +69,77 @@ else
c
end
# If expr with && on same line as condition and then
# If expr with `&&` on same line as condition and then
if a && b then
c
end
# If expr with && at the start of a separate line before then
# If expr with `&&` at the start of a separate line before then
if a
&& b
then
c
end
# If expr with `and` at the start of a separate line before then
# NOTE: This is not parsed correctly, `and b` is parsed as a call
if a
and b
then
c
end
# If expr with `||` at the start of a separate line before then
# NOTE: This is not parsed correctly due to the leading `||`
if a
|| b
then
c
end
# If expr with `or` at the start of a separate line before then
# NOTE: This is not parsed correctly, `or b` is parsed as a call
if a
or b
then
c
end
# If expr with repeated && at the start of a separate line before then
if a
&& b
&& c
then
d
end
# If expr with alternating && and || at the start of lines
# NOTE: This is not parsed correctly due to the leading `||`
if a
&& b
|| c
then
d
end
# If expr with operator at start of line and parentheses
# NOTE: This is not parsed correctly due to the leading `||`
if a
&& (b
|| c)
then
d
end
# If expr with operator at start of line and parentheses
# NOTE: This is not parsed correctly due to the leading `||`
if a
|| (b
&& c)
then
d
end
# If expr with && at end of line
if a &&
b