Skip to content

Commit ee36d32

Browse files
authored
Merge pull request github#12789 from jketema/inline
Turn inline expectation test into a parameterized module
2 parents 6f012d5 + 3efc78e commit ee36d32

File tree

5 files changed

+286
-215
lines changed

5 files changed

+286
-215
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
failures
2+
testFailures

cpp/ql/test/library-tests/dataflow/dataflow-tests/has-parameter-flow-out.ql

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ module AstTest {
55
private import semmle.code.cpp.dataflow.DataFlow::DataFlow
66
private import semmle.code.cpp.dataflow.internal.DataFlowPrivate
77

8-
class AstParameterDefTest extends InlineExpectationsTest {
9-
AstParameterDefTest() { this = "AstParameterDefTest" }
8+
module AstParameterDefTest implements TestSig {
9+
string getARelevantTag() { result = "ast-def" }
1010

11-
override string getARelevantTag() { result = "ast-def" }
12-
13-
override predicate hasActualResult(Location location, string element, string tag, string value) {
11+
predicate hasActualResult(Location location, string element, string tag, string value) {
1412
exists(Function f, Parameter p, RefParameterFinalValueNode n |
1513
p.isNamed() and
1614
n.getParameter() = p and
@@ -33,12 +31,10 @@ module IRTest {
3331
(if k = 0 then result = "" else result = "*" + stars(k - 1))
3432
}
3533

36-
class IRParameterDefTest extends InlineExpectationsTest {
37-
IRParameterDefTest() { this = "IRParameterDefTest" }
38-
39-
override string getARelevantTag() { result = "ir-def" }
34+
module IRParameterDefTest implements TestSig {
35+
string getARelevantTag() { result = "ir-def" }
4036

41-
override predicate hasActualResult(Location location, string element, string tag, string value) {
37+
predicate hasActualResult(Location location, string element, string tag, string value) {
4238
exists(Function f, Parameter p, FinalParameterNode n |
4339
p.isNamed() and
4440
n.getParameter() = p and
@@ -51,3 +47,5 @@ module IRTest {
5147
}
5248
}
5349
}
50+
51+
import MakeTest<MergeTests<AstTest::AstParameterDefTest, IRTest::IRParameterDefTest>>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
failures
2+
testFailures

cpp/ql/test/library-tests/dataflow/source-sink-tests/local-flow.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import cpp
44
import TestUtilities.InlineExpectationsTest
55
import semmle.code.cpp.security.FlowSources
66

7-
class LocalFlowSourceTest extends InlineExpectationsTest {
8-
LocalFlowSourceTest() { this = "LocalFlowSourceTest" }
7+
module LocalFlowSourceTest implements TestSig {
8+
string getARelevantTag() { result = "local_source" }
99

10-
override string getARelevantTag() { result = "local_source" }
11-
12-
override predicate hasActualResult(Location location, string element, string tag, string value) {
10+
predicate hasActualResult(Location location, string element, string tag, string value) {
1311
tag = "local_source" and
1412
exists(LocalFlowSource node, int n |
1513
n =
@@ -30,3 +28,5 @@ class LocalFlowSourceTest extends InlineExpectationsTest {
3028
)
3129
}
3230
}
31+
32+
import MakeTest<LocalFlowSourceTest>

0 commit comments

Comments
 (0)