Skip to content

Commit 22cdf94

Browse files
committed
Inline expectations: Ignore results in files outside the source dir
1 parent ddfc131 commit 22cdf94

26 files changed

Lines changed: 162 additions & 161 deletions

File tree

actions/ql/test/utils/ActionsInlineExpectationsTestQuery.ql

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ import T::TestPostProcessing
1010
private module Impl implements T::InlineExpectationsTestSig {
1111
class Location = Locations::Location;
1212

13-
class ExpectationComment extends Yaml::YamlComment {
14-
string getContents() { result = this.getText() }
15-
}
16-
}
17-
18-
private module Input implements T::TestPostProcessing::InputSig<Impl> {
1913
string getRelativeUrl(Locations::Location location) {
2014
exists(int startLine, int startColumn, int endLine, int endColumn |
2115
location.hasLocationInfo(_, startLine, startColumn, endLine, endColumn)
@@ -25,6 +19,10 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
2519
":" + endColumn
2620
)
2721
}
22+
23+
class ExpectationComment extends Yaml::YamlComment {
24+
string getContents() { result = this.getText() }
25+
}
2826
}
2927

30-
import T::TestPostProcessing::Make<Impl, Input>
28+
import T::TestPostProcessing::Make<Impl>

cpp/ql/lib/utils/test/InlineExpectationsTestQuery.ql

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,4 @@ private import cpp
66
private import codeql.util.test.InlineExpectationsTest as T
77
private import internal.InlineExpectationsTestImpl
88
import T::TestPostProcessing
9-
import T::TestPostProcessing::Make<Impl, Input>
10-
11-
private module Input implements T::TestPostProcessing::InputSig<Impl> {
12-
string getRelativeUrl(Location location) {
13-
exists(File f, int startline, int startcolumn, int endline, int endcolumn |
14-
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
15-
f = location.getFile()
16-
|
17-
result =
18-
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
19-
)
20-
}
21-
}
9+
import T::TestPostProcessing::Make<Impl>

cpp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,14 @@ module Impl implements InlineExpectationsTestSig {
2525
}
2626

2727
class Location = C::Location;
28+
29+
string getRelativeUrl(Location location) {
30+
exists(C::File f, int startline, int startcolumn, int endline, int endcolumn |
31+
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
32+
f = location.getFile()
33+
|
34+
result =
35+
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
36+
)
37+
}
2838
}

csharp/ql/lib/utils/test/InlineExpectationsTestQuery.ql

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,4 @@ private import csharp
66
private import codeql.util.test.InlineExpectationsTest as T
77
private import internal.InlineExpectationsTestImpl
88
import T::TestPostProcessing
9-
import T::TestPostProcessing::Make<Impl, Input>
10-
11-
private module Input implements T::TestPostProcessing::InputSig<Impl> {
12-
string getRelativeUrl(Location location) {
13-
exists(File f, int startline, int startcolumn, int endline, int endcolumn |
14-
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
15-
f = location.getFile()
16-
|
17-
result =
18-
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
19-
)
20-
}
21-
}
9+
import T::TestPostProcessing::Make<Impl>

csharp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,14 @@ module Impl implements InlineExpectationsTestSig {
4949
}
5050

5151
class Location = CS::Location;
52+
53+
string getRelativeUrl(Location location) {
54+
exists(CS::File f, int startline, int startcolumn, int endline, int endcolumn |
55+
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
56+
f = location.getFile()
57+
|
58+
result =
59+
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
60+
)
61+
}
5262
}

go/ql/lib/utils/test/InlineExpectationsTestQuery.ql

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,4 @@ private import go
66
private import codeql.util.test.InlineExpectationsTest as T
77
private import internal.InlineExpectationsTestImpl
88
import T::TestPostProcessing
9-
import T::TestPostProcessing::Make<Impl, Input>
10-
11-
private module Input implements T::TestPostProcessing::InputSig<Impl> {
12-
string getRelativeUrl(Location location) {
13-
exists(File f, int startline, int startcolumn, int endline, int endcolumn |
14-
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
15-
f = location.getFile()
16-
|
17-
result =
18-
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
19-
)
20-
}
21-
}
9+
import T::TestPostProcessing::Make<Impl>

go/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ module Impl implements InlineExpectationsTestSig {
2020
}
2121

2222
class Location = G::Location;
23+
24+
string getRelativeUrl(Location location) {
25+
exists(G::File f, int startline, int startcolumn, int endline, int endcolumn |
26+
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
27+
f = location.getFile()
28+
|
29+
result =
30+
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
31+
)
32+
}
2333
}

java/ql/lib/utils/test/InlineExpectationsTestQuery.ql

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,4 @@ private import java
66
private import codeql.util.test.InlineExpectationsTest as T
77
private import internal.InlineExpectationsTestImpl
88
import T::TestPostProcessing
9-
import T::TestPostProcessing::Make<Impl, Input>
10-
11-
private module Input implements T::TestPostProcessing::InputSig<Impl> {
12-
string getRelativeUrl(Location location) {
13-
exists(File f, int startline, int startcolumn, int endline, int endcolumn |
14-
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
15-
f = location.getFile()
16-
|
17-
result =
18-
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
19-
)
20-
}
21-
}
9+
import T::TestPostProcessing::Make<Impl>

java/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,14 @@ module Impl implements InlineExpectationsTestSig {
3535
}
3636

3737
class Location = J::Location;
38+
39+
string getRelativeUrl(Location location) {
40+
exists(J::File f, int startline, int startcolumn, int endline, int endcolumn |
41+
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
42+
f = location.getFile()
43+
|
44+
result =
45+
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
46+
)
47+
}
3848
}

java/ql/test-kotlin1/TestUtilities/internal/InlineExpectationsTestImpl.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,14 @@ module Impl implements InlineExpectationsTestSig {
3232
}
3333

3434
class Location = J::Location;
35+
36+
string getRelativeUrl(Location location) {
37+
exists(J::File f, int startline, int startcolumn, int endline, int endcolumn |
38+
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
39+
f = location.getFile()
40+
|
41+
result =
42+
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
43+
)
44+
}
3545
}

0 commit comments

Comments
 (0)