Skip to content

Commit f77c2ac

Browse files
committed
Update tests
1 parent ed00507 commit f77c2ac

File tree

5 files changed

+48
-21
lines changed

5 files changed

+48
-21
lines changed

ruby/ql/test/library-tests/ast/Ast.expected

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,12 +2260,8 @@ literals/literals.rb:
22602260
# 189| getAnOperand/getLeftOperand: [LocalVariableAccess] query
22612261
# 189| getAnOperand/getRightOperand: [HereDoc] <<'DOC'
22622262
# 189| getComponent: [StringTextComponent]
2263-
# 189| text without
2264-
# 190| getComponent: [StringInterpolationComponent] #{...}
2265-
# 190| getStmt: [MethodCall] call to interpolation
2266-
# 190| getReceiver: [SelfVariableAccess] self
2267-
# 190| getComponent: [StringTextComponent] !
2268-
# 190|
2263+
# 189| text without #{ interpolation } !
2264+
# 189|
22692265
# 193| getStmt: [AssignExpr] ... = ...
22702266
# 193| getAnOperand/getLeftOperand: [LocalVariableAccess] output
22712267
# 193| getAnOperand/getRightOperand: [HereDoc] <<`SCRIPT`
@@ -2293,6 +2289,17 @@ literals/literals.rb:
22932289
# 199| getKey: [SymbolLiteral] :Z
22942290
# 199| getComponent: [StringTextComponent] Z
22952291
# 199| getValue: [ConstantReadAccess] Z
2292+
# 201| getStmt: [StringLiteral] "@foo: #{...} @@bar: #{...} $_..."
2293+
# 201| getComponent: [StringTextComponent] @foo:
2294+
# 201| getComponent: [StringInterpolationComponent] #{...}
2295+
# 201| getStmt: [InstanceVariableAccess] @foo
2296+
# 201| getReceiver: [SelfVariableAccess] self
2297+
# 201| getComponent: [StringTextComponent] @@bar:
2298+
# 201| getComponent: [StringInterpolationComponent] #{...}
2299+
# 201| getStmt: [ClassVariableAccess] @@bar
2300+
# 201| getComponent: [StringTextComponent] $_:
2301+
# 201| getComponent: [StringInterpolationComponent] #{...}
2302+
# 201| getStmt: [GlobalVariableAccess] $_
22962303
control/loops.rb:
22972304
# 1| [Toplevel] loops.rb
22982305
# 2| getStmt: [AssignExpr] ... = ...

ruby/ql/test/library-tests/ast/TreeSitter.expected

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4539,6 +4539,18 @@ literals/literals.rb:
45394539
# 199| 0: [HashKeySymbol] Z
45404540
# 199| 1: [ReservedWord] :
45414541
# 199| 4: [ReservedWord] }
4542+
# 201| 135: [String] String
4543+
# 201| 0: [ReservedWord] "
4544+
# 201| 1: [StringContent] @foo:
4545+
# 201| 2: [Interpolation] Interpolation
4546+
# 201| 0: [InstanceVariable] @foo
4547+
# 201| 3: [StringContent] @@bar:
4548+
# 201| 4: [Interpolation] Interpolation
4549+
# 201| 0: [ClassVariable] @@bar
4550+
# 201| 5: [StringContent] $_:
4551+
# 201| 6: [Interpolation] Interpolation
4552+
# 201| 0: [GlobalVariable] $_
4553+
# 201| 7: [ReservedWord] "
45424554
# 1| [Comment] # boolean values and nil
45434555
# 9| [Comment] # decimal integers
45444556
# 14| [Comment] # max value representable by QL's int type
@@ -4640,14 +4652,9 @@ literals/literals.rb:
46404652
# 188| [Comment] # TODO: the parser currently does not handle single quoted heredocs correctly
46414653
# 189| [HeredocBody] HeredocBody
46424654
# 189| 0: [HeredocContent]
4643-
# 189| text without
4644-
# 190| 1: [Interpolation] Interpolation
4645-
# 190| 0: [ReservedWord] #{
4646-
# 190| 1: [Identifier] interpolation
4647-
# 190| 2: [ReservedWord] }
4648-
# 190| 2: [HeredocContent] !
4649-
# 190|
4650-
# 191| 3: [HeredocEnd] DOC
4655+
# 189| text without #{ interpolation } !
4656+
# 189|
4657+
# 191| 1: [HeredocEnd] DOC
46514658
# 193| [HeredocBody] HeredocBody
46524659
# 193| 0: [HeredocContent]
46534660
# 193| cat file.txt

ruby/ql/test/library-tests/ast/ValueText.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ exprValue
709709
| literals/literals.rb:168:9:168:13 | <<SQL | \nselect * from table\n | string |
710710
| literals/literals.rb:175:11:175:16 | <<-BLA | \nsome text\nand some more\n | string |
711711
| literals/literals.rb:180:9:180:19 | <<~SQUIGGLY | \n indented stuff\n | string |
712+
| literals/literals.rb:189:9:189:15 | <<'DOC' | \n text without #{ interpolation } !\n | string |
712713
| literals/literals.rb:193:10:193:19 | <<`SCRIPT` | \n cat file.txt\n | string |
713714
| literals/literals.rb:197:5:197:6 | 42 | 42 | int |
714715
| literals/literals.rb:198:2:198:2 | :x | :x | symbol |
@@ -1585,6 +1586,7 @@ exprCfgNodeValue
15851586
| literals/literals.rb:168:9:168:13 | <<SQL | \nselect * from table\n | string |
15861587
| literals/literals.rb:175:11:175:16 | <<-BLA | \nsome text\nand some more\n | string |
15871588
| literals/literals.rb:180:9:180:19 | <<~SQUIGGLY | \n indented stuff\n | string |
1589+
| literals/literals.rb:189:9:189:15 | <<'DOC' | \n text without #{ interpolation } !\n | string |
15881590
| literals/literals.rb:193:10:193:19 | <<`SCRIPT` | \n cat file.txt\n | string |
15891591
| literals/literals.rb:197:5:197:6 | 42 | 42 | int |
15901592
| literals/literals.rb:198:2:198:2 | :x | :x | symbol |

ruby/ql/test/library-tests/ast/literals/literals.expected

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ allLiterals
227227
| literals.rb:175:11:175:16 | <<-BLA | HereDoc | \nsome text\nand some more\n |
228228
| literals.rb:180:9:180:19 | <<~SQUIGGLY | HereDoc | \n indented stuff\n |
229229
| literals.rb:184:9:184:15 | <<"DOC" | HereDoc | <none> |
230-
| literals.rb:189:9:189:15 | <<'DOC' | HereDoc | <none> |
230+
| literals.rb:189:9:189:15 | <<'DOC' | HereDoc | \n text without #{ interpolation } !\n |
231231
| literals.rb:193:10:193:19 | <<`SCRIPT` | HereDoc | \n cat file.txt\n |
232232
| literals.rb:197:5:197:6 | 42 | IntegerLiteral | 42 |
233233
| literals.rb:198:1:198:9 | {...} | HashLiteral | <none> |
@@ -237,6 +237,7 @@ allLiterals
237237
| literals.rb:199:1:199:9 | {...} | HashLiteral | <none> |
238238
| literals.rb:199:2:199:2 | :y | SymbolLiteral | :y |
239239
| literals.rb:199:7:199:7 | :Z | SymbolLiteral | :Z |
240+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | <none> |
240241
stringlikeLiterals
241242
| literals.rb:59:1:59:2 | "" | |
242243
| literals.rb:60:1:60:2 | "" | |
@@ -345,12 +346,13 @@ stringlikeLiterals
345346
| literals.rb:175:11:175:16 | <<-BLA | \nsome text\nand some more\n |
346347
| literals.rb:180:9:180:19 | <<~SQUIGGLY | \n indented stuff\n |
347348
| literals.rb:184:9:184:15 | <<"DOC" | <none> |
348-
| literals.rb:189:9:189:15 | <<'DOC' | <none> |
349+
| literals.rb:189:9:189:15 | <<'DOC' | \n text without #{ interpolation } !\n |
349350
| literals.rb:193:10:193:19 | <<`SCRIPT` | \n cat file.txt\n |
350351
| literals.rb:198:2:198:2 | :x | :x |
351352
| literals.rb:198:6:198:6 | :y | :y |
352353
| literals.rb:199:2:199:2 | :y | :y |
353354
| literals.rb:199:7:199:7 | :Z | :Z |
355+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | <none> |
354356
stringLiterals
355357
| literals.rb:59:1:59:2 | "" | |
356358
| literals.rb:60:1:60:2 | "" | |
@@ -405,6 +407,7 @@ stringLiterals
405407
| literals.rb:163:1:163:34 | "abcdefghijklmnopqrstuvwxyzabcdef" | abcdefghijklmnopqrstuvwxyzabcdef |
406408
| literals.rb:164:1:164:35 | "foobarfoobarfoobarfoobarfooba..." | foobarfoobarfoobarfoobarfoobarfoo |
407409
| literals.rb:165:1:165:40 | "foobar\\\\foobar\\\\foobar\\\\fooba..." | foobar\\foobar\\foobar\\foobar\\foobar |
410+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | <none> |
408411
regExpLiterals
409412
| literals.rb:149:1:149:2 | // | | |
410413
| literals.rb:150:1:150:5 | /foo/ | foo | |
@@ -626,14 +629,18 @@ stringComponents
626629
| literals.rb:184:9:184:15 | <<"DOC" | HereDoc | 0 | literals.rb:184:16:185:11 | \n text with | StringTextComponent |
627630
| literals.rb:184:9:184:15 | <<"DOC" | HereDoc | 1 | literals.rb:185:12:185:29 | #{...} | StringInterpolationComponent |
628631
| literals.rb:184:9:184:15 | <<"DOC" | HereDoc | 2 | literals.rb:185:30:185:32 | !\n | StringTextComponent |
629-
| literals.rb:189:9:189:15 | <<'DOC' | HereDoc | 0 | literals.rb:189:16:190:14 | \n text without | StringTextComponent |
630-
| literals.rb:189:9:189:15 | <<'DOC' | HereDoc | 1 | literals.rb:190:15:190:32 | #{...} | StringInterpolationComponent |
631-
| literals.rb:189:9:189:15 | <<'DOC' | HereDoc | 2 | literals.rb:190:33:190:35 | !\n | StringTextComponent |
632+
| literals.rb:189:9:189:15 | <<'DOC' | HereDoc | 0 | literals.rb:189:16:190:35 | \n text without #{ interpolation } !\n | StringTextComponent |
632633
| literals.rb:193:10:193:19 | <<`SCRIPT` | HereDoc | 0 | literals.rb:193:20:194:14 | \n cat file.txt\n | StringTextComponent |
633634
| literals.rb:198:2:198:2 | :x | SymbolLiteral | 0 | literals.rb:198:2:198:2 | x | StringTextComponent |
634635
| literals.rb:198:6:198:6 | :y | SymbolLiteral | 0 | literals.rb:198:6:198:6 | y | StringTextComponent |
635636
| literals.rb:199:2:199:2 | :y | SymbolLiteral | 0 | literals.rb:199:2:199:2 | y | StringTextComponent |
636637
| literals.rb:199:7:199:7 | :Z | SymbolLiteral | 0 | literals.rb:199:7:199:7 | Z | StringTextComponent |
638+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | 0 | literals.rb:201:2:201:7 | @foo: | StringTextComponent |
639+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | 1 | literals.rb:201:8:201:12 | #{...} | StringInterpolationComponent |
640+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | 2 | literals.rb:201:13:201:20 | @@bar: | StringTextComponent |
641+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | 3 | literals.rb:201:21:201:26 | #{...} | StringInterpolationComponent |
642+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | 4 | literals.rb:201:27:201:31 | $_: | StringTextComponent |
643+
| literals.rb:201:1:201:35 | "@foo: #{...} @@bar: #{...} $_..." | StringLiteral | 5 | literals.rb:201:32:201:34 | #{...} | StringInterpolationComponent |
637644
stringInterpolations
638645
| literals.rb:71:10:71:19 | #{...} | 0 | literals.rb:71:13:71:17 | ... + ... | AddExpr |
639646
| literals.rb:72:12:72:21 | #{...} | 0 | literals.rb:72:15:72:19 | ... + ... | AddExpr |
@@ -659,7 +666,9 @@ stringInterpolations
659666
| literals.rb:146:10:146:19 | #{...} | 0 | literals.rb:146:13:146:17 | ... - ... | SubExpr |
660667
| literals.rb:171:14:171:22 | #{...} | 0 | literals.rb:171:17:171:20 | call to name | MethodCall |
661668
| literals.rb:185:12:185:29 | #{...} | 0 | literals.rb:185:15:185:27 | call to interpolation | MethodCall |
662-
| literals.rb:190:15:190:32 | #{...} | 0 | literals.rb:190:18:190:30 | call to interpolation | MethodCall |
669+
| literals.rb:201:8:201:12 | #{...} | 0 | literals.rb:201:9:201:12 | @foo | InstanceVariableAccess |
670+
| literals.rb:201:21:201:26 | #{...} | 0 | literals.rb:201:22:201:26 | @@bar | ClassVariableAccess |
671+
| literals.rb:201:32:201:34 | #{...} | 0 | literals.rb:201:33:201:34 | $_ | GlobalVariableAccess |
663672
concatenatedStrings
664673
| literals.rb:75:1:75:17 | "..." "..." | foobarbaz | 0 | literals.rb:75:1:75:5 | "foo" |
665674
| literals.rb:75:1:75:17 | "..." "..." | foobarbaz | 1 | literals.rb:75:7:75:11 | "bar" |

ruby/ql/test/library-tests/ast/literals/literals.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,6 @@ def m
196196

197197
x = 42
198198
{x:, y:5}
199-
{y: , Z:}
199+
{y: , Z:}
200+
201+
"@foo: #@foo @@bar: #@@bar $_: #$_"

0 commit comments

Comments
 (0)