Skip to content

Commit 24d4368

Browse files
author
Benjamin Muskalla
committed
Simplify test setup
1 parent 8830f15 commit 24d4368

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

java/ql/test/library-tests/dataflow/taint-format/A.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import java.lang.StringBuilder;
33

44
class A {
5-
public static String taint() {
5+
public static String source() {
66
return "tainted";
77
}
88

99
public static void test1() {
10-
String bad = taint(); // $ hasTaintFlow
10+
String bad = source(); // $ hasTaintFlow
1111
String good = "hi";
1212

1313
bad.formatted(good); // $ hasTaintFlow
@@ -18,7 +18,7 @@ public static void test1() {
1818
}
1919

2020
public static void test2() {
21-
String bad = taint(); // $ hasTaintFlow
21+
String bad = source(); // $ hasTaintFlow
2222
Formatter f = new Formatter();
2323

2424
f.toString();
@@ -27,7 +27,7 @@ public static void test2() {
2727
}
2828

2929
public static void test3() {
30-
String bad = taint(); // $ hasTaintFlow
30+
String bad = source(); // $ hasTaintFlow
3131
StringBuilder sb = new StringBuilder();
3232
Formatter f = new Formatter(sb);
3333

@@ -37,7 +37,7 @@ public static void test3() {
3737
}
3838

3939
public static void test4() {
40-
String bad = taint(); // $ hasTaintFlow
40+
String bad = source(); // $ hasTaintFlow
4141
StringBuilder sb = new StringBuilder();
4242

4343
sb.append(bad); // $ hasTaintFlow

java/ql/test/library-tests/dataflow/taint-format/test.ql

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import semmle.code.java.dataflow.DataFlow
33
import semmle.code.java.dataflow.TaintTracking
44
import TestUtilities.InlineFlowTest
55

6-
class TaintFlowConf extends TaintTracking::Configuration {
7-
TaintFlowConf() { this = "qltest:dataflow:format" }
8-
9-
override predicate isSource(DataFlow::Node n) {
10-
n.asExpr().(MethodAccess).getMethod().hasName("taint")
11-
}
12-
6+
class TaintFlowConf extends DefaultTaintFlowConf {
137
override predicate isSink(DataFlow::Node n) { n instanceof DataFlow::ExprNode }
148
}
159

0 commit comments

Comments
 (0)