Skip to content

Commit

Permalink
PS: Run tests and accept test changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasVP committed Sep 12, 2024
1 parent a484b92 commit fb9465d
Show file tree
Hide file tree
Showing 9 changed files with 461 additions and 444 deletions.
42 changes: 21 additions & 21 deletions powershell/ql/test/library-tests/ast/Arrays/arrays.expected
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
arrayExpr
| Arrays.ps1:11:11:11:25 | ArrayExpression at: Arrays.ps1:11:11:11:25 | Arrays.ps1:11:13:11:24 | StatementBlock at: Arrays.ps1:11:13:11:24 |
| Arrays.ps1:14:41:14:44 | ArrayExpression at: Arrays.ps1:14:41:14:44 | Arrays.ps1:0:0:0:0 | StatementBlock at: Arrays.ps1:0:0:0:0 |
| Arrays.ps1:11:11:11:25 | @(...) | Arrays.ps1:11:13:11:24 | {...} |
| Arrays.ps1:14:41:14:44 | @(...) | Arrays.ps1:0:0:0:0 | {...} |
arrayLiteral
| Arrays.ps1:1:11:1:37 | ArrayLiteral at: Arrays.ps1:1:11:1:37 | 0 | Arrays.ps1:1:11:1:12 | 1 |
| Arrays.ps1:1:11:1:37 | ArrayLiteral at: Arrays.ps1:1:11:1:37 | 1 | Arrays.ps1:1:13:1:14 | 2 |
| Arrays.ps1:1:11:1:37 | ArrayLiteral at: Arrays.ps1:1:11:1:37 | 2 | Arrays.ps1:1:15:1:18 | a |
| Arrays.ps1:1:11:1:37 | ArrayLiteral at: Arrays.ps1:1:11:1:37 | 3 | Arrays.ps1:1:19:1:24 | true |
| Arrays.ps1:1:11:1:37 | ArrayLiteral at: Arrays.ps1:1:11:1:37 | 4 | Arrays.ps1:1:25:1:31 | false |
| Arrays.ps1:1:11:1:37 | ArrayLiteral at: Arrays.ps1:1:11:1:37 | 5 | Arrays.ps1:1:32:1:37 | null |
| Arrays.ps1:5:34:5:37 | ArrayLiteral at: Arrays.ps1:5:34:5:37 | 0 | Arrays.ps1:5:34:5:35 | 2 |
| Arrays.ps1:5:34:5:37 | ArrayLiteral at: Arrays.ps1:5:34:5:37 | 1 | Arrays.ps1:5:36:5:37 | 2 |
| Arrays.ps1:6:9:6:12 | ArrayLiteral at: Arrays.ps1:6:9:6:12 | 0 | Arrays.ps1:6:9:6:10 | 0 |
| Arrays.ps1:6:9:6:12 | ArrayLiteral at: Arrays.ps1:6:9:6:12 | 1 | Arrays.ps1:6:11:6:12 | 0 |
| Arrays.ps1:7:9:7:12 | ArrayLiteral at: Arrays.ps1:7:9:7:12 | 0 | Arrays.ps1:7:9:7:10 | 1 |
| Arrays.ps1:7:9:7:12 | ArrayLiteral at: Arrays.ps1:7:9:7:12 | 1 | Arrays.ps1:7:11:7:12 | 0 |
| Arrays.ps1:8:9:8:12 | ArrayLiteral at: Arrays.ps1:8:9:8:12 | 0 | Arrays.ps1:8:9:8:10 | 0 |
| Arrays.ps1:8:9:8:12 | ArrayLiteral at: Arrays.ps1:8:9:8:12 | 1 | Arrays.ps1:8:11:8:12 | 1 |
| Arrays.ps1:9:9:9:12 | ArrayLiteral at: Arrays.ps1:9:9:9:12 | 0 | Arrays.ps1:9:9:9:10 | 1 |
| Arrays.ps1:9:9:9:12 | ArrayLiteral at: Arrays.ps1:9:9:9:12 | 1 | Arrays.ps1:9:11:9:12 | 1 |
| Arrays.ps1:11:13:11:24 | ArrayLiteral at: Arrays.ps1:11:13:11:24 | 0 | Arrays.ps1:11:13:11:16 | a |
| Arrays.ps1:11:13:11:24 | ArrayLiteral at: Arrays.ps1:11:13:11:24 | 1 | Arrays.ps1:11:17:11:20 | b |
| Arrays.ps1:11:13:11:24 | ArrayLiteral at: Arrays.ps1:11:13:11:24 | 2 | Arrays.ps1:11:21:11:24 | c |
| Arrays.ps1:1:11:1:37 | ...,... | 0 | Arrays.ps1:1:11:1:12 | 1 |
| Arrays.ps1:1:11:1:37 | ...,... | 1 | Arrays.ps1:1:13:1:14 | 2 |
| Arrays.ps1:1:11:1:37 | ...,... | 2 | Arrays.ps1:1:15:1:18 | a |
| Arrays.ps1:1:11:1:37 | ...,... | 3 | Arrays.ps1:1:19:1:24 | true |
| Arrays.ps1:1:11:1:37 | ...,... | 4 | Arrays.ps1:1:25:1:31 | false |
| Arrays.ps1:1:11:1:37 | ...,... | 5 | Arrays.ps1:1:32:1:37 | null |
| Arrays.ps1:5:34:5:37 | ...,... | 0 | Arrays.ps1:5:34:5:35 | 2 |
| Arrays.ps1:5:34:5:37 | ...,... | 1 | Arrays.ps1:5:36:5:37 | 2 |
| Arrays.ps1:6:9:6:12 | ...,... | 0 | Arrays.ps1:6:9:6:10 | 0 |
| Arrays.ps1:6:9:6:12 | ...,... | 1 | Arrays.ps1:6:11:6:12 | 0 |
| Arrays.ps1:7:9:7:12 | ...,... | 0 | Arrays.ps1:7:9:7:10 | 1 |
| Arrays.ps1:7:9:7:12 | ...,... | 1 | Arrays.ps1:7:11:7:12 | 0 |
| Arrays.ps1:8:9:8:12 | ...,... | 0 | Arrays.ps1:8:9:8:10 | 0 |
| Arrays.ps1:8:9:8:12 | ...,... | 1 | Arrays.ps1:8:11:8:12 | 1 |
| Arrays.ps1:9:9:9:12 | ...,... | 0 | Arrays.ps1:9:9:9:10 | 1 |
| Arrays.ps1:9:9:9:12 | ...,... | 1 | Arrays.ps1:9:11:9:12 | 1 |
| Arrays.ps1:11:13:11:24 | ...,... | 0 | Arrays.ps1:11:13:11:16 | a |
| Arrays.ps1:11:13:11:24 | ...,... | 1 | Arrays.ps1:11:17:11:20 | b |
| Arrays.ps1:11:13:11:24 | ...,... | 2 | Arrays.ps1:11:21:11:24 | c |
2 changes: 1 addition & 1 deletion powershell/ql/test/library-tests/ast/Arrays/arrays.ql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import powershell

query predicate arrayExpr(ArrayExpr arrayExpr, StmtBlock subExpr) { subExpr = arrayExpr.getStatementBlock() }
query predicate arrayExpr(ArrayExpr arrayExpr, StmtBlock subExpr) { subExpr = arrayExpr.getStmtBlock() }

query predicate arrayLiteral(ArrayLiteral arrayLiteral, int i, Expr e) {
e = arrayLiteral.getElement(i)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| ParamBlock.ps1:2:1:5:2 | ParamBlock | 0 | ParamBlock.ps1:3:5:4:23 | Parameter |
| ParamBlock.ps1:2:1:5:2 | param(...) | 0 | ParamBlock.ps1:3:5:4:23 | Parameter |
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
binaryExpr
| BinaryExpression.ps1:3:11:3:24 | ...+... | BinaryExpression.ps1:3:11:3:16 | val1 | BinaryExpression.ps1:3:19:3:24 | val2 |
| TernaryExpression.ps1:1:9:1:16 | ...+... | TernaryExpression.ps1:1:9:1:10 | 6 | TernaryExpression.ps1:1:15:1:16 | 7 |
| TernaryExpression.ps1:1:9:1:16 | ... -gt ... | TernaryExpression.ps1:1:9:1:10 | 6 | TernaryExpression.ps1:1:15:1:16 | 7 |
cmdExpr
| BinaryExpression.ps1:1:9:1:10 | 1 | BinaryExpression.ps1:1:9:1:10 | 1 |
| BinaryExpression.ps1:2:9:2:10 | 2 | BinaryExpression.ps1:2:9:2:10 | 2 |
| BinaryExpression.ps1:3:11:3:24 | ...+... | BinaryExpression.ps1:3:11:3:24 | ...+... |
| BinaryExpression.ps1:4:1:4:8 | result | BinaryExpression.ps1:4:1:4:8 | result |
| ExpandableString.ps1:1:1:1:40 | ExpandableStringExpression at: ExpandableString.ps1:1:1:1:40 | ExpandableString.ps1:1:1:1:40 | ExpandableStringExpression at: ExpandableString.ps1:1:1:1:40 |
| ExpandableString.ps1:1:23:1:38 | (no string representation) | file://:0:0:0:0 | (no string representation) |
| SubExpression.ps1:1:1:1:24 | ArrayExpression at: SubExpression.ps1:1:1:1:24 | SubExpression.ps1:1:1:1:24 | ArrayExpression at: SubExpression.ps1:1:1:1:24 |
| SubExpression.ps1:2:1:2:22 | ArrayExpression at: SubExpression.ps1:2:1:2:22 | SubExpression.ps1:2:1:2:22 | ArrayExpression at: SubExpression.ps1:2:1:2:22 |
| ExpandableString.ps1:1:1:1:40 | Date: $([DateTime]::Now)\nName: $name | ExpandableString.ps1:1:1:1:40 | Date: $([DateTime]::Now)\nName: $name |
| ExpandableString.ps1:1:23:1:38 | Now | ExpandableString.ps1:1:23:1:38 | Now |
| SubExpression.ps1:1:1:1:24 | call to AddDays | SubExpression.ps1:1:1:1:24 | call to AddDays |
| SubExpression.ps1:2:1:2:22 | call to AddDays | SubExpression.ps1:2:1:2:22 | call to AddDays |
| TernaryExpression.ps1:1:8:1:23 | ...?...:... | TernaryExpression.ps1:1:8:1:23 | ...?...:... |
| TernaryExpression.ps1:1:9:1:16 | ...+... | TernaryExpression.ps1:1:9:1:16 | ...+... |
| TernaryExpression.ps1:1:9:1:16 | ... -gt ... | TernaryExpression.ps1:1:9:1:16 | ... -gt ... |
invokeMemoryExpression
| SubExpression.ps1:1:1:1:24 | ArrayExpression at: SubExpression.ps1:1:1:1:24 | file://:0:0:0:0 | (no string representation) | 0 | SubExpression.ps1:1:21:1:23 | 10 |
| SubExpression.ps1:1:1:1:24 | call to AddDays | SubExpression.ps1:1:1:1:12 | $(...) | 0 | SubExpression.ps1:1:21:1:23 | 10 |
expandableString
| ExpandableString.ps1:1:1:1:40 | ExpandableStringExpression at: ExpandableString.ps1:1:1:1:40 | 0 | ExpandableString.ps1:1:8:1:13 | name |
| ExpandableString.ps1:1:1:1:40 | ExpandableStringExpression at: ExpandableString.ps1:1:1:1:40 | 1 | file://:0:0:0:0 | (no string representation) |
| ExpandableString.ps1:1:1:1:40 | Date: $([DateTime]::Now)\nName: $name | 0 | ExpandableString.ps1:1:8:1:13 | name |
| ExpandableString.ps1:1:1:1:40 | Date: $([DateTime]::Now)\nName: $name | 1 | ExpandableString.ps1:1:21:1:39 | $(...) |
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ query predicate cmdExpr(CmdExpr cmd, Expr e) {
e = cmd.getExpr()
}

query predicate invokeMemoryExpression(InvokeMemberExpression invoke, Expr e, int i, Expr arg) {
e = invoke.getExpression() and
query predicate invokeMemoryExpression(InvokeMemberExpr invoke, Expr e, int i, Expr arg) {
e = invoke.getBase() and
arg = invoke.getArgument(i)
}

query predicate expandableString(ExpandableStringExpression expandable, int i, Expr e) {
query predicate expandableString(ExpandableStringExpr expandable, int i, Expr e) {
e = expandable.getExpr(i)
}
6 changes: 3 additions & 3 deletions powershell/ql/test/library-tests/ast/Loops/loops.expected
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
doUntil
| DoUntil.ps1:1:1:7:19 | DoUntil | DoUntil.ps1:7:10:7:18 | ...\|... | DoUntil.ps1:2:1:7:2 | StatementBlock at: DoUntil.ps1:2:1:7:2 |
| DoUntil.ps1:1:1:7:19 | DoUntil | DoUntil.ps1:7:10:7:18 | ... -le ... | DoUntil.ps1:2:1:7:2 | {...} |
doWhile
| DoWhile.ps1:1:1:7:19 | DoWhile | DoWhile.ps1:7:10:7:18 | ...\|... | DoWhile.ps1:2:1:7:2 | StatementBlock at: DoWhile.ps1:2:1:7:2 |
| DoWhile.ps1:1:1:7:19 | DoWhile | DoWhile.ps1:7:10:7:18 | ... -le ... | DoWhile.ps1:2:1:7:2 | {...} |
while
| While.ps1:2:1:13:2 | while(...) {...} | While.ps1:2:8:2:18 | ...\|... | While.ps1:3:1:13:2 | StatementBlock at: While.ps1:3:1:13:2 |
| While.ps1:2:1:13:2 | while(...) {...} | While.ps1:2:8:2:18 | ... -le ... | While.ps1:3:1:13:2 | {...} |
42 changes: 21 additions & 21 deletions powershell/ql/test/library-tests/ast/Statements/statements.expected
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
| ExitStatement.ps1:1:1:1:8 | exit ... |
| ExitStatement.ps1:1:6:1:8 | -1 |
| ExitStatement.ps1:1:6:1:8 | ...\|... |
| ExitStatement.ps1:1:6:1:8 | -1 |
| IfStatement.ps1:1:1:1:7 | ...=... |
| IfStatement.ps1:1:6:1:7 | 4 |
| IfStatement.ps1:3:1:8:2 | if (...) {...} else {...} |
| IfStatement.ps1:3:5:3:13 | ...+... |
| IfStatement.ps1:3:5:3:13 | ...\|... |
| IfStatement.ps1:4:2:4:36 | ...\|... |
| IfStatement.ps1:4:2:4:36 | ExpandableStringExpression at: IfStatement.ps1:4:2:4:36 |
| IfStatement.ps1:7:2:7:21 | ...\|... |
| IfStatement.ps1:7:2:7:21 | ExpandableStringExpression at: IfStatement.ps1:7:2:7:21 |
| TrapStatement.ps1:1:1:4:2 | FunctionDefinition at: TrapStatement.ps1:1:1:4:2 |
| IfStatement.ps1:3:5:3:13 | ... -ge ... |
| IfStatement.ps1:3:5:3:13 | ... -ge ... |
| IfStatement.ps1:4:2:4:36 | $x is greater than or equal to 3 |
| IfStatement.ps1:4:2:4:36 | $x is greater than or equal to 3 |
| IfStatement.ps1:7:2:7:21 | $x is less than 3 |
| IfStatement.ps1:7:2:7:21 | $x is less than 3 |
| TrapStatement.ps1:1:1:4:2 | TrapTest |
| TrapStatement.ps1:2:5:2:26 | TrapStatement at: TrapStatement.ps1:2:5:2:26 |
| TrapStatement.ps1:2:11:2:25 | ...\|... |
| TrapStatement.ps1:2:11:2:25 | Error found. |
| TrapStatement.ps1:3:5:3:19 | ...\|... |
| TrapStatement.ps1:2:11:2:25 | Error found. |
| TrapStatement.ps1:3:5:3:19 | nonsenseString |
| TrapStatement.ps1:3:5:3:19 | nonsenseString |
| TrapStatement.ps1:6:1:6:9 | ...\|... |
| TrapStatement.ps1:6:1:6:9 | TrapTest |
| TrapStatement.ps1:6:1:6:9 | TrapTest |
| Try.ps1:1:1:13:2 | try {...} |
| Try.ps1:2:4:2:95 | ...=... |
| Try.ps1:2:17:2:95 | ...\|... |
| Try.ps1:2:17:2:95 | New-Object |
| Try.ps1:2:69:2:94 | ...\|... |
| Try.ps1:2:69:2:94 | ArrayLiteral at: Try.ps1:2:69:2:94 |
| Try.ps1:3:11:3:21 | ...\|... |
| Try.ps1:2:17:2:95 | New-Object |
| Try.ps1:2:69:2:94 | ...,... |
| Try.ps1:2:69:2:94 | ...,... |
| Try.ps1:3:5:3:21 | throw ... |
| Try.ps1:3:11:3:21 | Exception |
| Try.ps1:6:5:6:64 | ...\|... |
| Try.ps1:3:11:3:21 | Exception |
| Try.ps1:6:5:6:64 | Unable to download MyDoc.doc from http://www.contoso.com. |
| Try.ps1:6:5:6:64 | Unable to download MyDoc.doc from http://www.contoso.com. |
| Try.ps1:9:5:9:52 | ...\|... |
| Try.ps1:9:5:9:52 | An error occurred that could not be resolved. |
| Try.ps1:12:5:12:37 | ...\|... |
| Try.ps1:9:5:9:52 | An error occurred that could not be resolved. |
| Try.ps1:12:5:12:37 | The finally block is executed. |
| UseProcessBlockForPipelineCommand.ps1:1:1:11:2 | FunctionDefinition at: UseProcessBlockForPipelineCommand.ps1:1:1:11:2 |
| UseProcessBlockForPipelineCommand.ps1:10:5:10:12 | ...\|... |
| Try.ps1:12:5:12:37 | The finally block is executed. |
| UseProcessBlockForPipelineCommand.ps1:1:1:11:2 | Get-Number |
| UseProcessBlockForPipelineCommand.ps1:10:5:10:12 | Number |
| UseProcessBlockForPipelineCommand.ps1:10:5:10:12 | Number |
| file://:0:0:0:0 | (no string representation) |
Loading

0 comments on commit fb9465d

Please sign in to comment.