Skip to content

Commit 6d2bf68

Browse files
author
Max Schaefer
committed
Use inline expectations for all framework-mode tests.
1 parent 6c47a5d commit 6d2bf68

12 files changed

+59
-58
lines changed

java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractCandidates.expected

Lines changed: 0 additions & 25 deletions
This file was deleted.

java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractCandidates.qlref

Lines changed: 0 additions & 1 deletion
This file was deleted.

java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractNegativeExamples.expected

Lines changed: 0 additions & 6 deletions
This file was deleted.

java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractNegativeExamples.qlref

Lines changed: 0 additions & 1 deletion
This file was deleted.

java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractPositiveExamples.expected

Lines changed: 0 additions & 2 deletions
This file was deleted.

java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractPositiveExamples.qlref

Lines changed: 0 additions & 1 deletion
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
testFailures
2+
failures
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import java
2+
import AutomodelFrameworkModeCharacteristics as Characteristics
3+
import TestUtilities.InlineExpectationsTest
4+
import AutomodelExtractionTests
5+
6+
module TestHelper implements TestHelperSig<Characteristics::FrameworkCandidatesImpl> {
7+
Location getEndpointLocation(Characteristics::Endpoint endpoint) {
8+
result = endpoint.asTop().getLocation()
9+
}
10+
11+
predicate isCandidate(
12+
Characteristics::Endpoint endpoint, string name, string signature, string input, string output,
13+
string extensibleType
14+
) {
15+
Characteristics::isCandidate(endpoint, _, _, _, name, signature, input, output, _,
16+
extensibleType, _)
17+
}
18+
19+
predicate isPositiveExample(
20+
Characteristics::Endpoint endpoint, string endpointType, string name, string signature,
21+
string input, string output, string extensibleType
22+
) {
23+
Characteristics::isPositiveExample(endpoint, endpointType, _, _, _, name, signature, input,
24+
output, _, extensibleType)
25+
}
26+
27+
predicate isNegativeExample(
28+
Characteristics::Endpoint endpoint, string name, string signature, string input, string output,
29+
string extensibleType
30+
) {
31+
Characteristics::isNegativeExample(endpoint, _, _, _, _, _, name, signature, input, output, _,
32+
extensibleType)
33+
}
34+
}
35+
36+
import MakeTest<Extraction<Characteristics::FrameworkCandidatesImpl, TestHelper>>
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
package com.github.codeql.test;
22

33
public class PublicClass {
4-
public void stuff(String arg) { // `arg` is a sink candidate, `this` is a candidate, `arg` is a source candidate (overrideable method)
4+
public void stuff(String arg) { // $ sinkModel=stuff(String):Argument[this] sourceModel=stuff(String):Parameter[this] sinkModel=stuff(String):Argument[0] sourceModel=stuff(String):Parameter[0] // source candidates because it is an overrideable method
55
System.out.println(arg);
66
}
77

8-
public static void staticStuff(String arg) { // `arg` is a sink candidate, but not a source candidate (not overrideabe); `this` is not a candidate (static method)
8+
public static void staticStuff(String arg) { // $ sinkModel=staticStuff(String):Argument[0] // `arg` is not a source candidate (not overrideabe); `this` is not a candidate (static method)
99
System.out.println(arg);
1010
}
1111

12-
// `arg` and `this` are candidates because the method is protected (may be called from downstream repositories). The return value is a candidate source for the same reason.
13-
protected void nonPublicStuff(String arg) {
12+
protected void nonPublicStuff(String arg) { // $ sinkModel=nonPublicStuff(String):Argument[this] sourceModel=nonPublicStuff(String):Parameter[this] sinkModel=nonPublicStuff(String):Argument[0] sourceModel=nonPublicStuff(String):Parameter[0]
1413
System.out.println(arg);
1514
}
1615

17-
// `arg` and `this are not candidates because the method is not public:
18-
void packagePrivateStuff(String arg) {
16+
void packagePrivateStuff(String arg) { // no candidates because the method is not public
1917
System.out.println(arg);
2018
}
2119

22-
public PublicClass(Object input) {
23-
// the `this` qualifier is not a candidate
20+
public PublicClass(Object input) { // $ sourceModel=PublicClass(Object):ReturnValue sinkModel=PublicClass(Object):Argument[0] // `this` is not a candidate because it is a constructor
2421
}
2522

26-
public Boolean isIgnored(Object input) { // `input` is a source candidate, but not a sink candidate (is-style method); `this` is not a candidate
23+
// `input` and `input` are source candidates, but not sink candidates (is-style method)
24+
public Boolean isIgnored(Object input) { // $ negativeExample=isIgnored(Object):Argument[this] sourceModel=isIgnored(Object):Parameter[this] negativeExample=isIgnored(Object):Argument[0] sourceModel=isIgnored(Object):Parameter[0]
2725
return false;
2826
}
2927
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.github.codeql.test;
22

33
public interface PublicInterface {
4-
public int stuff(String arg); // `arg` is a candidate, `this` is a candidate, method stuff is _not_ a candidate source (primitive return type), `arg` is a source candidate (overridable method)
4+
public int stuff(String arg); // $ sinkModel=stuff(String):Argument[this] sourceModel=stuff(String):Parameter[this] sinkModel=stuff(String):Argument[0] sourceModel=stuff(String):Parameter[0] // result is _not_ a source candidate source (primitive return type)
55

6-
public static void staticStuff(String arg) { // `arg` is a candidate, `this` is not a candidate (static method)
6+
public static void staticStuff(String arg) { // $ sinkModel=staticStuff(String):Argument[0] // not a source candidate (static method)
77
System.out.println(arg);
88
}
99
}

0 commit comments

Comments
 (0)