Skip to content

Commit 49993b0

Browse files
committed
Java: Rewrite inline expectation tests to use parameterized module
1 parent 97c4f49 commit 49993b0

File tree

132 files changed

+466
-336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

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

java/ql/integration-tests/all-platforms/kotlin/default-parameter-mad-flow/test.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ module Config implements DataFlow::ConfigSig {
1919

2020
module Flow = TaintTracking::Global<Config>;
2121

22-
class InlineFlowTest extends InlineExpectationsTest {
23-
InlineFlowTest() { this = "HasFlowTest" }
22+
module InlineFlowTest implements TestSig {
23+
string getARelevantTag() { result = "flow" }
2424

25-
override string getARelevantTag() { result = "flow" }
26-
27-
override predicate hasActualResult(Location location, string element, string tag, string value) {
25+
predicate hasActualResult(Location location, string element, string tag, string value) {
2826
tag = "flow" and
2927
exists(DataFlow::Node sink | Flow::flowTo(sink) |
3028
sink.getLocation() = location and
@@ -33,3 +31,5 @@ class InlineFlowTest extends InlineExpectationsTest {
3331
)
3432
}
3533
}
34+
35+
import MakeTest<InlineFlowTest>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
failures
2+
testFailures

java/ql/test/library-tests/dataflow/callback-dispatch/test.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ module Config implements DataFlow::ConfigSig {
1212

1313
module Flow = DataFlow::Global<Config>;
1414

15-
class HasFlowTest extends InlineExpectationsTest {
16-
HasFlowTest() { this = "HasFlowTest" }
15+
module HasFlowTest implements TestSig {
16+
string getARelevantTag() { result = "flow" }
1717

18-
override string getARelevantTag() { result = "flow" }
19-
20-
override predicate hasActualResult(Location location, string element, string tag, string value) {
18+
predicate hasActualResult(Location location, string element, string tag, string value) {
2119
tag = "flow" and
2220
exists(DataFlow::Node src, DataFlow::Node sink | Flow::flow(src, sink) |
2321
sink.getLocation() = location and
@@ -26,3 +24,5 @@ class HasFlowTest extends InlineExpectationsTest {
2624
)
2725
}
2826
}
27+
28+
import MakeTest<HasFlowTest>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
failures
2+
testFailures

java/ql/test/library-tests/dataflow/entrypoint-types/EntryPointTypesTest.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ module TaintFlowConfig implements DataFlow::ConfigSig {
1818

1919
module TaintFlow = TaintTracking::Global<TaintFlowConfig>;
2020

21-
class HasFlowTest extends InlineExpectationsTest {
22-
HasFlowTest() { this = "HasFlowTest" }
21+
module HasFlowTest implements TestSig {
22+
string getARelevantTag() { result = "hasTaintFlow" }
2323

24-
override string getARelevantTag() { result = ["hasTaintFlow"] }
25-
26-
override predicate hasActualResult(Location location, string element, string tag, string value) {
24+
predicate hasActualResult(Location location, string element, string tag, string value) {
2725
tag = "hasTaintFlow" and
2826
exists(DataFlow::Node sink | TaintFlow::flowTo(sink) |
2927
sink.getLocation() = location and
@@ -32,3 +30,5 @@ class HasFlowTest extends InlineExpectationsTest {
3230
)
3331
}
3432
}
33+
34+
import MakeTest<HasFlowTest>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
failures
2+
testFailures

java/ql/test/library-tests/dataflow/state/test.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ module Flow = TaintTracking::GlobalWithState<Config>;
5959

6060
module PartialFlow = Flow::FlowExploration<explorationLimit/0>;
6161

62-
class HasFlowTest extends InlineExpectationsTest {
63-
HasFlowTest() { this = "HasFlowTest" }
62+
module HasFlowTest implements TestSig {
63+
string getARelevantTag() { result = ["pFwd", "pRev", "flow"] }
6464

65-
override string getARelevantTag() { result = ["pFwd", "pRev", "flow"] }
66-
67-
override predicate hasActualResult(Location location, string element, string tag, string value) {
65+
predicate hasActualResult(Location location, string element, string tag, string value) {
6866
tag = "flow" and
6967
exists(Flow::PathNode src, Flow::PathNode sink |
7068
Flow::flowPath(src, sink) and
@@ -92,3 +90,5 @@ class HasFlowTest extends InlineExpectationsTest {
9290
)
9391
}
9492
}
93+
94+
import MakeTest<HasFlowTest>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
failures
2+
testFailures

java/ql/test/library-tests/dataflow/taintsources/local.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ module LocalTaintConfig implements DataFlow::ConfigSig {
2626

2727
module LocalTaintFlow = TaintTracking::Global<LocalTaintConfig>;
2828

29-
class LocalFlowTest extends InlineExpectationsTest {
30-
LocalFlowTest() { this = "LocalFlowTest" }
29+
module LocalFlowTest implements TestSig {
30+
string getARelevantTag() { result = ["hasLocalValueFlow", "hasLocalTaintFlow"] }
3131

32-
override string getARelevantTag() { result = ["hasLocalValueFlow", "hasLocalTaintFlow"] }
33-
34-
override predicate hasActualResult(Location location, string element, string tag, string value) {
32+
predicate hasActualResult(Location location, string element, string tag, string value) {
3533
tag = "hasLocalValueFlow" and
3634
exists(DataFlow::Node sink | LocalValueFlow::flowTo(sink) |
3735
sink.getLocation() = location and
@@ -49,3 +47,5 @@ class LocalFlowTest extends InlineExpectationsTest {
4947
)
5048
}
5149
}
50+
51+
import MakeTest<LocalFlowTest>

0 commit comments

Comments
 (0)