Skip to content

Commit b3855b0

Browse files
committed
Ruby: some more tests
1 parent ccaa129 commit b3855b0

File tree

11 files changed

+55
-0
lines changed

11 files changed

+55
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,6 +2853,9 @@ operations/operations.rb:
28532853
# 102| getReceiver: [SelfVariableAccess] self
28542854
# 102| getArgument: [IntegerLiteral] 1
28552855
# 102| getAnOperand/getRightOperand: [IntegerLiteral] 7
2856+
# 103| getStmt: [AssignLogicalOrExpr] ... ||= ...
2857+
# 103| getAnOperand/getLeftOperand: [ConstantAssignment, ConstantReadAccess] CONSTANT4
2858+
# 103| getAnOperand/getRightOperand: [IntegerLiteral] 7
28562859
params/params.rb:
28572860
# 1| [Toplevel] params.rb
28582861
# 4| getStmt: [Method] identifier_method_params

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,12 @@ operations/operations.rb:
904904
# 102| getAnOperand/getLeftOperand/getReceiver: [ConstantReadAccess] OtherConstant
905905
# 102| getScopeExpr: [LocalVariableAccess] __synth__0
906906
# 102| getAnOperand/getArgument/getRightOperand: [IntegerLiteral] 7
907+
# 103| [AssignLogicalOrExpr] ... ||= ...
908+
# 103| getDesugared: [AssignExpr] ... = ...
909+
# 103| getAnOperand/getLeftOperand: [ConstantAssignment, ConstantReadAccess] CONSTANT4
910+
# 103| getAnOperand/getRightOperand: [LogicalOrExpr] ... || ...
911+
# 103| getAnOperand/getLeftOperand/getReceiver: [ConstantReadAccess] CONSTANT4
912+
# 103| getAnOperand/getArgument/getRightOperand: [IntegerLiteral] 7
907913
params/params.rb:
908914
# 8| [HashLiteral] {...}
909915
# 8| getDesugared: [MethodCall] call to []

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5571,6 +5571,12 @@ operations/operations.rb:
55715571
# 102| 2: [Constant] OtherConstant
55725572
# 102| 1: [ReservedWord] ||=
55735573
# 102| 2: [Integer] 7
5574+
# 103| 71: [OperatorAssignment] OperatorAssignment
5575+
# 103| 0: [ScopeResolution] ScopeResolution
5576+
# 103| 0: [ReservedWord] ::
5577+
# 103| 1: [Constant] CONSTANT4
5578+
# 103| 1: [ReservedWord] ||=
5579+
# 103| 2: [Integer] 7
55745580
# 1| [Comment] # Start with assignments to all the identifiers used below, so that they are
55755581
# 2| [Comment] # interpreted as variables.
55765582
# 22| [Comment] # Unary operations

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ exprValue
894894
| operations/operations.rb:101:25:101:25 | 8 | 8 | int |
895895
| operations/operations.rb:102:5:102:5 | 1 | 1 | int |
896896
| operations/operations.rb:102:31:102:31 | 7 | 7 | int |
897+
| operations/operations.rb:103:17:103:17 | 7 | 7 | int |
897898
| params/params.rb:41:46:41:46 | 7 | 7 | int |
898899
| params/params.rb:47:19:47:21 | :bar | :bar | symbol |
899900
| params/params.rb:47:24:47:24 | 2 | 2 | int |
@@ -1776,6 +1777,7 @@ exprCfgNodeValue
17761777
| operations/operations.rb:101:25:101:25 | 8 | 8 | int |
17771778
| operations/operations.rb:102:5:102:5 | 1 | 1 | int |
17781779
| operations/operations.rb:102:31:102:31 | 7 | 7 | int |
1780+
| operations/operations.rb:103:17:103:17 | 7 | 7 | int |
17791781
| params/params.rb:41:46:41:46 | 7 | 7 | int |
17801782
| params/params.rb:47:19:47:21 | :bar | :bar | symbol |
17811783
| params/params.rb:47:24:47:24 | 2 | 2 | int |

ruby/ql/test/library-tests/ast/operations/assignment.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ assignments
6363
| operations.rb:102:1:102:10 | ... = ... | = | operations.rb:102:1:102:10 | __synth__0 | operations.rb:102:1:102:10 | call to bar | AssignExpr |
6464
| operations.rb:102:1:102:31 | ... = ... | = | operations.rb:102:1:102:25 | OtherConstant | operations.rb:102:27:102:29 | ... \|\| ... | AssignExpr |
6565
| operations.rb:102:1:102:31 | ... \|\|= ... | \|\|= | operations.rb:102:1:102:25 | OtherConstant | operations.rb:102:31:102:31 | 7 | AssignLogicalOrExpr |
66+
| operations.rb:103:1:103:17 | ... = ... | = | operations.rb:103:1:103:11 | CONSTANT4 | operations.rb:103:13:103:15 | ... \|\| ... | AssignExpr |
67+
| operations.rb:103:1:103:17 | ... \|\|= ... | \|\|= | operations.rb:103:1:103:11 | CONSTANT4 | operations.rb:103:17:103:17 | 7 | AssignLogicalOrExpr |
6668
assignOperations
6769
| operations.rb:69:1:69:8 | ... += ... | += | operations.rb:69:1:69:1 | x | operations.rb:69:6:69:8 | 128 | AssignAddExpr |
6870
| operations.rb:70:1:70:7 | ... -= ... | -= | operations.rb:70:1:70:1 | y | operations.rb:70:6:70:7 | 32 | AssignSubExpr |
@@ -84,6 +86,7 @@ assignOperations
8486
| operations.rb:100:1:100:15 | ... \|\|= ... | \|\|= | operations.rb:100:1:100:9 | CONSTANT3 | operations.rb:100:15:100:15 | 7 | AssignLogicalOrExpr |
8587
| operations.rb:101:1:101:25 | ... \|\|= ... | \|\|= | operations.rb:101:1:101:19 | MemberConstant | operations.rb:101:25:101:25 | 8 | AssignLogicalOrExpr |
8688
| operations.rb:102:1:102:31 | ... \|\|= ... | \|\|= | operations.rb:102:1:102:25 | OtherConstant | operations.rb:102:31:102:31 | 7 | AssignLogicalOrExpr |
89+
| operations.rb:103:1:103:17 | ... \|\|= ... | \|\|= | operations.rb:103:1:103:11 | CONSTANT4 | operations.rb:103:17:103:17 | 7 | AssignLogicalOrExpr |
8790
assignArithmeticOperations
8891
| operations.rb:69:1:69:8 | ... += ... | += | operations.rb:69:1:69:1 | x | operations.rb:69:6:69:8 | 128 | AssignAddExpr |
8992
| operations.rb:70:1:70:7 | ... -= ... | -= | operations.rb:70:1:70:1 | y | operations.rb:70:6:70:7 | 32 | AssignSubExpr |
@@ -101,6 +104,7 @@ assignLogicalOperations
101104
| operations.rb:100:1:100:15 | ... \|\|= ... | \|\|= | operations.rb:100:1:100:9 | CONSTANT3 | operations.rb:100:15:100:15 | 7 | AssignLogicalOrExpr |
102105
| operations.rb:101:1:101:25 | ... \|\|= ... | \|\|= | operations.rb:101:1:101:19 | MemberConstant | operations.rb:101:25:101:25 | 8 | AssignLogicalOrExpr |
103106
| operations.rb:102:1:102:31 | ... \|\|= ... | \|\|= | operations.rb:102:1:102:25 | OtherConstant | operations.rb:102:31:102:31 | 7 | AssignLogicalOrExpr |
107+
| operations.rb:103:1:103:17 | ... \|\|= ... | \|\|= | operations.rb:103:1:103:11 | CONSTANT4 | operations.rb:103:17:103:17 | 7 | AssignLogicalOrExpr |
104108
assignBitwiseOperations
105109
| operations.rb:81:2:81:8 | ... <<= ... | <<= | operations.rb:81:2:81:2 | x | operations.rb:81:8:81:8 | 2 | AssignLShiftExpr |
106110
| operations.rb:82:2:82:8 | ... >>= ... | >>= | operations.rb:82:2:82:2 | y | operations.rb:82:8:82:8 | 3 | AssignRShiftExpr |

ruby/ql/test/library-tests/ast/operations/binary.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ binaryOperations
4444
| operations.rb:100:11:100:13 | ... \|\| ... | \|\| | operations.rb:100:1:100:9 | CONSTANT3 | operations.rb:100:15:100:15 | 7 | LogicalOrExpr |
4545
| operations.rb:101:21:101:23 | ... \|\| ... | \|\| | operations.rb:101:1:101:19 | MemberConstant | operations.rb:101:25:101:25 | 8 | LogicalOrExpr |
4646
| operations.rb:102:27:102:29 | ... \|\| ... | \|\| | operations.rb:102:1:102:25 | OtherConstant | operations.rb:102:31:102:31 | 7 | LogicalOrExpr |
47+
| operations.rb:103:13:103:15 | ... \|\| ... | \|\| | operations.rb:103:1:103:11 | CONSTANT4 | operations.rb:103:17:103:17 | 7 | LogicalOrExpr |
4748
binaryArithmeticOperations
4849
| operations.rb:32:1:32:7 | ... + ... | + | operations.rb:32:1:32:1 | w | operations.rb:32:5:32:7 | 234 | AddExpr |
4950
| operations.rb:33:1:33:6 | ... - ... | - | operations.rb:33:1:33:1 | x | operations.rb:33:5:33:6 | 17 | SubExpr |
@@ -71,6 +72,7 @@ binaryLogicalOperations
7172
| operations.rb:100:11:100:13 | ... \|\| ... | \|\| | operations.rb:100:1:100:9 | CONSTANT3 | operations.rb:100:15:100:15 | 7 | LogicalOrExpr |
7273
| operations.rb:101:21:101:23 | ... \|\| ... | \|\| | operations.rb:101:1:101:19 | MemberConstant | operations.rb:101:25:101:25 | 8 | LogicalOrExpr |
7374
| operations.rb:102:27:102:29 | ... \|\| ... | \|\| | operations.rb:102:1:102:25 | OtherConstant | operations.rb:102:31:102:31 | 7 | LogicalOrExpr |
75+
| operations.rb:103:13:103:15 | ... \|\| ... | \|\| | operations.rb:103:1:103:11 | CONSTANT4 | operations.rb:103:17:103:17 | 7 | LogicalOrExpr |
7476
binaryBitwiseOperations
7577
| operations.rb:46:1:46:6 | ... << ... | << | operations.rb:46:1:46:1 | x | operations.rb:46:6:46:6 | 3 | LShiftExpr |
7678
| operations.rb:47:1:47:7 | ... >> ... | >> | operations.rb:47:1:47:1 | y | operations.rb:47:6:47:7 | 16 | RShiftExpr |

ruby/ql/test/library-tests/ast/operations/operation.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,9 @@
224224
| operations.rb:102:1:102:31 | ... \|\|= ... | \|\|= | operations.rb:102:31:102:31 | 7 | AssignLogicalOrExpr |
225225
| operations.rb:102:27:102:29 | ... \|\| ... | \|\| | operations.rb:102:1:102:25 | OtherConstant | LogicalOrExpr |
226226
| operations.rb:102:27:102:29 | ... \|\| ... | \|\| | operations.rb:102:31:102:31 | 7 | LogicalOrExpr |
227+
| operations.rb:103:1:103:17 | ... = ... | = | operations.rb:103:1:103:11 | CONSTANT4 | AssignExpr |
228+
| operations.rb:103:1:103:17 | ... = ... | = | operations.rb:103:13:103:15 | ... \|\| ... | AssignExpr |
229+
| operations.rb:103:1:103:17 | ... \|\|= ... | \|\|= | operations.rb:103:1:103:11 | CONSTANT4 | AssignLogicalOrExpr |
230+
| operations.rb:103:1:103:17 | ... \|\|= ... | \|\|= | operations.rb:103:17:103:17 | 7 | AssignLogicalOrExpr |
231+
| operations.rb:103:13:103:15 | ... \|\| ... | \|\| | operations.rb:103:1:103:11 | CONSTANT4 | LogicalOrExpr |
232+
| operations.rb:103:13:103:15 | ... \|\| ... | \|\| | operations.rb:103:17:103:17 | 7 | LogicalOrExpr |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,4 @@ class X
100100
CONSTANT3 ||= 7
101101
Foo::MemberConstant ||= 8
102102
foo(1).bar::OtherConstant ||= 7
103+
::CONSTANT4 ||= 7

ruby/ql/test/library-tests/controlflow/graph/Cfg.expected

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3816,6 +3816,25 @@ constant_compound_assign.rb:
38163816
#-----| -> ... || ...
38173817

38183818
# 16| top_after
3819+
#-----| -> TOP_CONSTANT2
3820+
3821+
# 19| TOP_CONSTANT2
3822+
#-----| -> TOP_CONSTANT2
3823+
3824+
# 19| TOP_CONSTANT2
3825+
#-----| true -> ... || ...
3826+
#-----| false -> 123
3827+
3828+
# 19| ... = ...
3829+
#-----| -> top_after2
3830+
3831+
# 19| ... || ...
3832+
#-----| -> ... = ...
3833+
3834+
# 19| 123
3835+
#-----| -> ... || ...
3836+
3837+
# 21| top_after2
38193838
#-----| -> exit constant_compound_assign.rb (normal)
38203839

38213840
desugar.rb:

ruby/ql/test/library-tests/controlflow/graph/Nodes.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ positionalArguments
214214
| cfg.rb:205:4:205:5 | call to == | cfg.rb:205:1:205:3 | __synth__0__1 |
215215
| constant_compound_assign.rb:5:18:5:20 | ... \|\| ... | constant_compound_assign.rb:5:22:5:24 | 123 |
216216
| constant_compound_assign.rb:14:14:14:16 | ... \|\| ... | constant_compound_assign.rb:14:18:14:20 | 123 |
217+
| constant_compound_assign.rb:19:17:19:19 | ... \|\| ... | constant_compound_assign.rb:19:21:19:23 | 123 |
217218
| desugar.rb:2:5:2:6 | ... + ... | desugar.rb:2:8:2:8 | 1 |
218219
| desugar.rb:6:3:6:13 | call to count= | desugar.rb:6:17:6:17 | ... = ... |
219220
| desugar.rb:10:3:10:10 | call to []= | desugar.rb:10:9:10:9 | 0 |

0 commit comments

Comments
 (0)