Update tests

This commit is contained in:
Arthur Baars
2022-04-26 18:51:55 +02:00
parent 20a3e3a8ae
commit d055f9a186
12 changed files with 330 additions and 211 deletions

View File

@@ -1716,11 +1716,11 @@ escape_sequences/escapes.rb:
literals/literals.rb:
# 1| [Toplevel] literals.rb
# 2| getStmt: [NilLiteral] nil
# 3| getStmt: [NilLiteral] NIL
# 3| getStmt: [ConstantReadAccess] NIL
# 4| getStmt: [BooleanLiteral] false
# 5| getStmt: [BooleanLiteral] FALSE
# 5| getStmt: [ConstantReadAccess] FALSE
# 6| getStmt: [BooleanLiteral] true
# 7| getStmt: [BooleanLiteral] TRUE
# 7| getStmt: [ConstantReadAccess] TRUE
# 10| getStmt: [IntegerLiteral] 1234
# 11| getStmt: [IntegerLiteral] 5_678
# 12| getStmt: [IntegerLiteral] 0
@@ -1752,6 +1752,8 @@ literals/literals.rb:
# 48| getStmt: [RationalLiteral] 23r
# 49| getStmt: [RationalLiteral] 9.85r
# 52| getStmt: [ComplexLiteral] 2i
# 53| getStmt: [ComplexLiteral] 3.14i
# 56| getStmt: [ComplexLiteral] 1.2ri
# 59| getStmt: [StringLiteral] ""
# 60| getStmt: [StringLiteral] ""
# 61| getStmt: [StringLiteral] "hello"
@@ -2054,10 +2056,10 @@ literals/literals.rb:
# 139| getStmt: [RangeLiteral] _ .. _
# 139| getEnd: [IntegerLiteral] 1
# 140| getStmt: [ParenthesizedExpr] ( ... )
# 140| getStmt: [SubExpr] ... - ...
# 140| getAnOperand/getLeftOperand/getReceiver: [RangeLiteral] _ .. _
# 140| getBegin: [IntegerLiteral] 0
# 140| getAnOperand/getArgument/getRightOperand: [IntegerLiteral] 1
# 140| getStmt: [RangeLiteral] _ .. _
# 140| getBegin: [IntegerLiteral] 0
# 140| getEnd: [UnaryMinusExpr] - ...
# 140| getAnOperand/getOperand/getReceiver: [IntegerLiteral] 1
# 143| getStmt: [SubshellLiteral] `ls -l`
# 143| getComponent: [StringTextComponent] ls -l
# 144| getStmt: [SubshellLiteral] `ls -l`
@@ -2990,6 +2992,16 @@ params/params.rb:
# 83| getReceiver: [LocalVariableAccess] array
# 83| getArgument: [BlockArgument] &...
# 83| getValue: [LocalVariableAccess] __synth__0
# 86| getStmt: [MethodCall] call to run_block
# 86| getReceiver: [SelfVariableAccess] self
# 86| getBlock: [BraceBlock] { ... }
# 86| getParameter: [SimpleParameter] x
# 86| getDefiningAccess: [LocalVariableAccess] x
# 86| getLocalVariable: [LocalVariableAccess] y
# 86| getLocalVariable: [LocalVariableAccess] z
# 86| getStmt: [MethodCall] call to puts
# 86| getReceiver: [SelfVariableAccess] self
# 86| getArgument: [LocalVariableAccess] x
erb/template.html.erb:
# 19| [Toplevel] template.html.erb
# 19| getStmt: [StringLiteral] "hello world"

File diff suppressed because it is too large Load Diff

View File

@@ -450,11 +450,8 @@ exprValue
| gems/test.gemspec:9:3:9:12 | __synth__0 | https://github.com/github/codeql-ruby | string |
| gems/test.gemspec:9:19:9:57 | "https://github.com/github/cod..." | https://github.com/github/codeql-ruby | string |
| literals/literals.rb:2:1:2:3 | nil | nil | nil |
| literals/literals.rb:3:1:3:3 | NIL | nil | nil |
| literals/literals.rb:4:1:4:5 | false | false | boolean |
| literals/literals.rb:5:1:5:5 | FALSE | false | boolean |
| literals/literals.rb:6:1:6:4 | true | true | boolean |
| literals/literals.rb:7:1:7:4 | TRUE | true | boolean |
| literals/literals.rb:10:1:10:4 | 1234 | 1234 | int |
| literals/literals.rb:11:1:11:5 | 5_678 | 5678 | int |
| literals/literals.rb:12:1:12:1 | 0 | 0 | int |
@@ -480,6 +477,8 @@ exprValue
| literals/literals.rb:48:1:48:3 | 23r | 23/1 | rational |
| literals/literals.rb:49:1:49:5 | 9.85r | 985/100 | rational |
| literals/literals.rb:52:1:52:2 | 2i | 0+2i | complex |
| literals/literals.rb:53:1:53:5 | 3.14i | 0+3.14i | complex |
| literals/literals.rb:56:1:56:5 | 1.2ri | 0+1.2i | complex |
| literals/literals.rb:59:1:59:2 | "" | | string |
| literals/literals.rb:60:1:60:2 | "" | | string |
| literals/literals.rb:61:1:61:7 | "hello" | hello | string |
@@ -648,6 +647,7 @@ exprValue
| literals/literals.rb:138:2:138:2 | 1 | 1 | int |
| literals/literals.rb:139:4:139:4 | 1 | 1 | int |
| literals/literals.rb:140:2:140:2 | 0 | 0 | int |
| literals/literals.rb:140:5:140:6 | - ... | -1 | int |
| literals/literals.rb:140:6:140:6 | 1 | 1 | int |
| literals/literals.rb:143:1:143:7 | `ls -l` | ls -l | string |
| literals/literals.rb:144:1:144:9 | `ls -l` | ls -l | string |
@@ -1313,11 +1313,8 @@ exprCfgNodeValue
| gems/test.gemspec:9:3:9:12 | __synth__0 | https://github.com/github/codeql-ruby | string |
| gems/test.gemspec:9:19:9:57 | "https://github.com/github/cod..." | https://github.com/github/codeql-ruby | string |
| literals/literals.rb:2:1:2:3 | nil | nil | nil |
| literals/literals.rb:3:1:3:3 | NIL | nil | nil |
| literals/literals.rb:4:1:4:5 | false | false | boolean |
| literals/literals.rb:5:1:5:5 | FALSE | false | boolean |
| literals/literals.rb:6:1:6:4 | true | true | boolean |
| literals/literals.rb:7:1:7:4 | TRUE | true | boolean |
| literals/literals.rb:10:1:10:4 | 1234 | 1234 | int |
| literals/literals.rb:11:1:11:5 | 5_678 | 5678 | int |
| literals/literals.rb:12:1:12:1 | 0 | 0 | int |
@@ -1343,6 +1340,8 @@ exprCfgNodeValue
| literals/literals.rb:48:1:48:3 | 23r | 23/1 | rational |
| literals/literals.rb:49:1:49:5 | 9.85r | 985/100 | rational |
| literals/literals.rb:52:1:52:2 | 2i | 0+2i | complex |
| literals/literals.rb:53:1:53:5 | 3.14i | 0+3.14i | complex |
| literals/literals.rb:56:1:56:5 | 1.2ri | 0+1.2i | complex |
| literals/literals.rb:59:1:59:2 | "" | | string |
| literals/literals.rb:60:1:60:2 | "" | | string |
| literals/literals.rb:61:1:61:7 | "hello" | hello | string |
@@ -1511,6 +1510,7 @@ exprCfgNodeValue
| literals/literals.rb:138:2:138:2 | 1 | 1 | int |
| literals/literals.rb:139:4:139:4 | 1 | 1 | int |
| literals/literals.rb:140:2:140:2 | 0 | 0 | int |
| literals/literals.rb:140:5:140:6 | - ... | -1 | int |
| literals/literals.rb:140:6:140:6 | 1 | 1 | int |
| literals/literals.rb:143:1:143:7 | `ls -l` | ls -l | string |
| literals/literals.rb:144:1:144:9 | `ls -l` | ls -l | string |

View File

@@ -117,7 +117,7 @@ callsWithArguments
callsWithReceiver
| calls.rb:2:1:2:5 | call to foo | calls.rb:2:1:2:5 | self |
| calls.rb:5:1:5:10 | call to bar | calls.rb:5:1:5:3 | Foo |
| calls.rb:8:1:8:7 | call to bar | calls.rb:8:1:8:7 | self |
| calls.rb:8:3:8:7 | call to bar | calls.rb:8:3:8:7 | self |
| calls.rb:11:1:11:7 | call to bar | calls.rb:11:1:11:3 | 123 |
| calls.rb:14:1:14:11 | call to foo | calls.rb:14:1:14:11 | self |
| calls.rb:17:1:17:17 | call to foo | calls.rb:17:1:17:17 | self |

View File

@@ -1,10 +1,7 @@
allLiterals
| literals.rb:2:1:2:3 | nil | NilLiteral | nil |
| literals.rb:3:1:3:3 | NIL | NilLiteral | nil |
| literals.rb:4:1:4:5 | false | BooleanLiteral | false |
| literals.rb:5:1:5:5 | FALSE | BooleanLiteral | false |
| literals.rb:6:1:6:4 | true | BooleanLiteral | true |
| literals.rb:7:1:7:4 | TRUE | BooleanLiteral | true |
| literals.rb:10:1:10:4 | 1234 | IntegerLiteral | 1234 |
| literals.rb:11:1:11:5 | 5_678 | IntegerLiteral | 5678 |
| literals.rb:12:1:12:1 | 0 | IntegerLiteral | 0 |
@@ -36,6 +33,8 @@ allLiterals
| literals.rb:48:1:48:3 | 23r | RationalLiteral | 23/1 |
| literals.rb:49:1:49:5 | 9.85r | RationalLiteral | 985/100 |
| literals.rb:52:1:52:2 | 2i | ComplexLiteral | 0+2i |
| literals.rb:53:1:53:5 | 3.14i | ComplexLiteral | 0+3.14i |
| literals.rb:56:1:56:5 | 1.2ri | ComplexLiteral | 0+1.2i |
| literals.rb:59:1:59:2 | "" | StringLiteral | |
| literals.rb:60:1:60:2 | "" | StringLiteral | |
| literals.rb:61:1:61:7 | "hello" | StringLiteral | hello |
@@ -194,7 +193,7 @@ allLiterals
| literals.rb:139:2:139:4 | _ .. _ | RangeLiteral | <none> |
| literals.rb:139:4:139:4 | 1 | IntegerLiteral | 1 |
| literals.rb:140:2:140:2 | 0 | IntegerLiteral | 0 |
| literals.rb:140:2:140:4 | _ .. _ | RangeLiteral | <none> |
| literals.rb:140:2:140:6 | _ .. _ | RangeLiteral | <none> |
| literals.rb:140:6:140:6 | 1 | IntegerLiteral | 1 |
| literals.rb:143:1:143:7 | `ls -l` | SubshellLiteral | ls -l |
| literals.rb:144:1:144:9 | `ls -l` | SubshellLiteral | ls -l |
@@ -767,18 +766,18 @@ finiteRangeLiterals
| literals.rb:135:2:135:7 | _ ... _ | literals.rb:135:2:135:2 | 1 | literals.rb:135:6:135:7 | 10 |
| literals.rb:136:2:136:7 | _ .. _ | literals.rb:136:2:136:2 | 1 | literals.rb:136:7:136:7 | 0 |
| literals.rb:137:2:137:11 | _ .. _ | literals.rb:137:2:137:6 | call to start | literals.rb:137:9:137:11 | ... + ... |
| literals.rb:140:2:140:6 | _ .. _ | literals.rb:140:2:140:2 | 0 | literals.rb:140:5:140:6 | - ... |
beginlessRangeLiterals
| literals.rb:139:2:139:4 | _ .. _ | literals.rb:139:4:139:4 | 1 |
endlessRangeLiterals
| literals.rb:138:2:138:4 | _ .. _ | literals.rb:138:2:138:2 | 1 |
| literals.rb:140:2:140:4 | _ .. _ | literals.rb:140:2:140:2 | 0 |
inclusiveRangeLiterals
| literals.rb:134:2:134:6 | _ .. _ |
| literals.rb:136:2:136:7 | _ .. _ |
| literals.rb:137:2:137:11 | _ .. _ |
| literals.rb:138:2:138:4 | _ .. _ |
| literals.rb:139:2:139:4 | _ .. _ |
| literals.rb:140:2:140:4 | _ .. _ |
| literals.rb:140:2:140:6 | _ .. _ |
exclusiveRangeLiterals
| literals.rb:135:2:135:7 | _ ... _ |
numericLiterals
@@ -813,6 +812,8 @@ numericLiterals
| literals.rb:48:1:48:3 | 23r | RationalLiteral | 23/1 |
| literals.rb:49:1:49:5 | 9.85r | RationalLiteral | 985/100 |
| literals.rb:52:1:52:2 | 2i | ComplexLiteral | 0+2i |
| literals.rb:53:1:53:5 | 3.14i | ComplexLiteral | 0+3.14i |
| literals.rb:56:1:56:5 | 1.2ri | ComplexLiteral | 0+1.2i |
| literals.rb:71:13:71:13 | 2 | IntegerLiteral | 2 |
| literals.rb:71:17:71:17 | 2 | IntegerLiteral | 2 |
| literals.rb:72:15:72:15 | 3 | IntegerLiteral | 3 |
@@ -952,3 +953,5 @@ rationalLiterals
| literals.rb:49:1:49:5 | 9.85r | RationalLiteral | 985/100 |
complexLiterals
| literals.rb:52:1:52:2 | 2i | ComplexLiteral | 0+2i |
| literals.rb:53:1:53:5 | 3.14i | ComplexLiteral | 0+3.14i |
| literals.rb:56:1:56:5 | 1.2ri | ComplexLiteral | 0+1.2i |

View File

@@ -50,10 +50,10 @@ TRUE
# imaginary/complex numbers
2i
#3.14i # BAD: parse error
3.14i
# imaginary & rational
#1.2ri # BAD: parse error
1.2ri
# strings
""
@@ -137,7 +137,7 @@ BAR = "bar"
(start..2+3)
(1..) # 1 to infinity
(..1) # -infinity to 1
(0..-1) # BAD: parsed as binary with minus endless range on the LHS
(0..-1)
# subshell
`ls -l`

View File

@@ -36,6 +36,7 @@ idParams
| params.rb:73:27:73:32 | wibble | wibble |
| params.rb:77:16:77:18 | val | val |
| params.rb:81:31:81:35 | array | array |
| params.rb:86:14:86:14 | x | x |
blockParams
| params.rb:46:28:46:33 | &block | block |
| params.rb:62:29:62:34 | &block | block |
@@ -103,6 +104,7 @@ paramsInBlocks
| params.rb:65:25:67:3 | do ... end | 1 | params.rb:65:35:65:37 | age | OptionalParameter |
| params.rb:77:12:78:3 | do ... end | 0 | params.rb:77:16:77:18 | val | SimpleParameter |
| params.rb:77:12:78:3 | do ... end | 1 | params.rb:77:21:77:25 | **nil | HashSplatNilParameter |
| params.rb:86:11:86:31 | { ... } | 0 | params.rb:86:14:86:14 | x | SimpleParameter |
paramsInLambdas
| params.rb:14:7:14:33 | -> { ... } | 0 | params.rb:14:11:14:13 | foo | SimpleParameter |
| params.rb:14:7:14:33 | -> { ... } | 1 | params.rb:14:16:14:18 | bar | SimpleParameter |
@@ -162,3 +164,4 @@ params
| params.rb:77:21:77:25 | **nil | 1 | HashSplatNilParameter |
| params.rb:81:31:81:35 | array | 0 | SimpleParameter |
| params.rb:81:38:81:38 | & | 1 | BlockParameter |
| params.rb:86:14:86:14 | x | 0 | SimpleParameter |

View File

@@ -82,3 +82,5 @@ def anonymous_block_parameter(array, &)
proc(&)
array.each(&)
end
run_block { |x; y, z | puts x }

View File

@@ -2010,14 +2010,20 @@ cfg.rb:
#-----| -> complex
# 59| complex
#-----| -> 10-2i
#-----| -> 10
# 59| ... = ...
#-----| -> conditional
# 59| 10-2i
# 59| 10
#-----| -> 2i
# 59| ... - ...
#-----| -> ... = ...
# 59| 2i
#-----| -> ... - ...
# 60| conditional
#-----| -> self
@@ -3528,7 +3534,7 @@ cfg.rb:
#-----| -> exit forward_param
# 196| forward_param
#-----| -> exit cfg.rb (normal)
#-----| -> 1
# 196| a
#-----| -> b
@@ -3551,6 +3557,70 @@ cfg.rb:
# 197| ...
#-----| -> call to bar
# 200| 1
#-----| -> { ... }
# 200| call to times
#-----| -> 2
# 200| enter { ... }
#-----| -> a
# 200| exit { ... }
# 200| exit { ... } (normal)
#-----| -> exit { ... }
# 200| { ... }
#-----| -> call to times
# 200| a
#-----| -> b
# 200| b
#-----| -> Kernel
# 200| Kernel
#-----| -> a
# 200| call to puts
#-----| -> exit { ... } (normal)
# 200| a
#-----| -> call to puts
# 202| 2
#-----| -> do ... end
# 202| call to times
#-----| -> exit cfg.rb (normal)
# 202| do ... end
#-----| -> call to times
# 202| enter do ... end
#-----| -> c
# 202| exit do ... end
# 202| exit do ... end (normal)
#-----| -> exit do ... end
# 202| c
#-----| -> d
# 202| d
#-----| -> Kernel
# 202| Kernel
#-----| -> c
# 202| call to puts
#-----| -> exit do ... end (normal)
# 202| c
#-----| -> call to puts
desugar.rb:
# 1| enter m1
#-----| -> x

View File

@@ -39,6 +39,8 @@ callsWithNoArguments
| cfg.rb:167:5:167:10 | ! ... |
| cfg.rb:168:5:168:8 | - ... |
| cfg.rb:194:1:194:23 | call to run_block |
| cfg.rb:200:1:200:32 | call to times |
| cfg.rb:202:1:202:35 | call to times |
| desugar.rb:6:3:6:7 | call to foo |
| desugar.rb:10:3:10:7 | call to foo |
| desugar.rb:14:3:14:7 | call to foo |
@@ -122,6 +124,7 @@ positionalArguments
| cfg.rb:49:8:49:13 | ... == ... | cfg.rb:49:13:49:13 | 0 |
| cfg.rb:49:16:49:20 | ... > ... | cfg.rb:49:20:49:20 | 1 |
| cfg.rb:49:27:49:37 | call to puts | cfg.rb:49:32:49:37 | "some" |
| cfg.rb:59:13:59:17 | ... - ... | cfg.rb:59:16:59:17 | 2i |
| cfg.rb:60:17:60:22 | ... < ... | cfg.rb:60:21:60:22 | 10 |
| cfg.rb:62:4:62:4 | call to [] | cfg.rb:62:4:62:4 | 0 |
| cfg.rb:62:7:62:12 | call to [] | cfg.rb:62:7:62:12 | 1 |
@@ -198,6 +201,8 @@ positionalArguments
| cfg.rb:194:16:194:21 | call to puts | cfg.rb:194:21:194:21 | x |
| cfg.rb:197:3:197:13 | call to bar | cfg.rb:197:7:197:7 | b |
| cfg.rb:197:3:197:13 | call to bar | cfg.rb:197:10:197:12 | ... |
| cfg.rb:200:18:200:30 | call to puts | cfg.rb:200:30:200:30 | a |
| cfg.rb:202:19:202:31 | call to puts | cfg.rb:202:31:202:31 | c |
| desugar.rb:2:5:2:6 | ... + ... | desugar.rb:2:8:2:8 | 1 |
| desugar.rb:6:3:6:13 | call to count= | desugar.rb:6:17:6:17 | ... = ... |
| desugar.rb:10:3:10:10 | call to []= | desugar.rb:10:9:10:9 | 0 |

View File

@@ -197,6 +197,10 @@ def forward_param(a, b, ...)
bar(b, ...)
end
1.times { |a; b| Kernel.puts a }
2.times do |c; d| Kernel.puts c end
__END__
Some ignored nonsense

View File

@@ -1,11 +1,9 @@
parameterVariable
| nested_scopes.rb:15:23:15:23 | a | nested_scopes.rb:15:23:15:23 | a |
| nested_scopes.rb:16:26:16:26 | x | nested_scopes.rb:16:26:16:26 | x |
| nested_scopes.rb:16:29:16:29 | a | nested_scopes.rb:16:29:16:29 | a |
| nested_scopes.rb:18:26:18:26 | x | nested_scopes.rb:18:26:18:26 | x |
| nested_scopes.rb:22:21:22:21 | a | nested_scopes.rb:22:21:22:21 | a |
| parameters.rb:1:14:1:14 | x | parameters.rb:1:14:1:14 | x |
| parameters.rb:1:18:1:18 | y | parameters.rb:1:18:1:18 | y |
| parameters.rb:7:17:7:22 | client | parameters.rb:7:17:7:22 | client |
| parameters.rb:7:25:7:31 | *pizzas | parameters.rb:7:26:7:31 | pizzas |
| parameters.rb:15:15:15:19 | **map | parameters.rb:15:17:15:19 | map |