mirror of
https://github.com/github/codeql.git
synced 2026-05-25 00:27:09 +02:00
PS: Add some simple SSA tests.
This commit is contained in:
8
powershell/ql/test/library-tests/ssa/explicit.ps1
Normal file
8
powershell/ql/test/library-tests/ssa/explicit.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
$glo_a = 42
|
||||
$glob_b = $glob_a
|
||||
|
||||
function f() {
|
||||
$a = 43
|
||||
$b = $a
|
||||
return $b
|
||||
}
|
||||
11
powershell/ql/test/library-tests/ssa/parameters.ps1
Normal file
11
powershell/ql/test/library-tests/ssa/parameters.ps1
Normal file
@@ -0,0 +1,11 @@
|
||||
function function-param([int]$n1, [int]$n2) {
|
||||
return $n1 + $n2
|
||||
}
|
||||
|
||||
function param-block {
|
||||
param(
|
||||
[int]$a,
|
||||
[int]$b
|
||||
)
|
||||
return $a + $b
|
||||
}
|
||||
2
powershell/ql/test/library-tests/ssa/ssa.expected
Normal file
2
powershell/ql/test/library-tests/ssa/ssa.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| explicit.ps1:1:1:8:2 | <uninitialized> glob_a | explicit.ps1:2:11:2:18 | glob_a |
|
||||
| explicit.ps1:5:5:5:7 | a | explicit.ps1:5:5:5:7 | a |
|
||||
4
powershell/ql/test/library-tests/ssa/ssa.ql
Normal file
4
powershell/ql/test/library-tests/ssa/ssa.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import powershell
|
||||
import semmle.code.powershell.dataflow.Ssa
|
||||
|
||||
query predicate definition(Ssa::Definition def, Variable v) { def.getSourceVariable() = v }
|
||||
Reference in New Issue
Block a user