Skip to content

Commit ca3f481

Browse files
committed
JS: Update ImportEquals test
1 parent d82d23a commit ca3f481

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

javascript/ql/test/library-tests/TypeScript/ImportEquals/tests.expected

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
legacyDataFlowDifference
12
dataFlowModuleImports
23
| ./esDefaultExport | tst.ts:1:26:1:53 | require ... xport') |
34
| ./esNamedExports | tst.ts:2:18:2:44 | require ... ports') |
@@ -29,4 +30,4 @@ resolution
2930
| tst.ts:10:1:10:20 | new NodeFullExport() | nodeFullExport.ts:3:18:3:40 | class N ... port {} | tst.ts | NodeFullExport | nodeFullExport.ts |
3031
| tst.ts:11:1:11:31 | new nod ... xport() | nodeNamedExport.ts:3:27:3:50 | class N ... port {} | tst.ts | NodeNamedExport | nodeNamedExport.ts |
3132
taint
32-
| test taint config | taintSource.ts:3:27:3:47 | externa ... ource() | tst.ts:18:19:18:42 | taintSo ... edValue |
33+
| taintSource.ts:3:27:3:47 | externa ... ource() | tst.ts:18:19:18:42 | taintSo ... edValue |

javascript/ql/test/library-tests/TypeScript/ImportEquals/tests.ql

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,26 @@ query predicate resolution(
3838
klassFile = klass.getFile().getBaseName()
3939
}
4040

41-
class TaintConfig extends TaintTracking::Configuration {
42-
TaintConfig() { this = "test taint config" }
43-
44-
override predicate isSource(DataFlow::Node node) {
41+
module TestConfig implements DataFlow::ConfigSig {
42+
predicate isSource(DataFlow::Node node) {
4543
node = DataFlow::moduleImport("externalTaintSource").getACall()
4644
}
4745

48-
override predicate isSink(DataFlow::Node node) {
46+
predicate isSink(DataFlow::Node node) {
4947
node = DataFlow::moduleImport("externalTaintSink").getACall().getArgument(0)
5048
}
5149
}
5250

53-
query predicate taint(TaintConfig cfg, DataFlow::Node source, DataFlow::Node sink) {
54-
cfg.hasFlow(source, sink)
51+
module TestFlow = TaintTracking::Global<TestConfig>;
52+
53+
query predicate taint = TestFlow::flow/2;
54+
55+
class LegacyConfig extends TaintTracking::Configuration {
56+
LegacyConfig() { this = "LegacyConfig" }
57+
58+
override predicate isSource(DataFlow::Node source) { TestConfig::isSource(source) }
59+
60+
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
5561
}
62+
63+
import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>

0 commit comments

Comments
 (0)