Skip to content

Commit 826e6a9

Browse files
committed
PS: Add an inline expectations test library for flow sources.
1 parent dcc1278 commit 826e6a9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Inline flow source tests for Powershell.
3+
*/
4+
5+
import powershell
6+
private import codeql.util.test.InlineExpectationsTest
7+
private import internal.InlineExpectationsTestImpl
8+
private import semmle.code.powershell.dataflow.flowsources.FlowSources
9+
import Make<Impl>
10+
11+
module InlineFlowSourceTest implements TestSig {
12+
string getARelevantTag() { result = "type" }
13+
14+
bindingset[s]
15+
private string quote(string s) {
16+
if s.matches("% %") then result = "\"" + s + "\"" else result = s
17+
}
18+
19+
predicate hasActualResult(Location location, string element, string tag, string value) {
20+
exists(SourceNode sourceNode |
21+
sourceNode.getLocation() = location and
22+
tag = "type" and
23+
quote(sourceNode.getSourceType()) = value and
24+
element = sourceNode.toString()
25+
)
26+
}
27+
}
28+
29+
import MakeTest<InlineFlowSourceTest>

0 commit comments

Comments
 (0)