Skip to content

Commit 1eaa491

Browse files
aibaarshvitved
authored andcommitted
Rust: update integration tests
1 parent c69aa22 commit 1eaa491

File tree

4 files changed

+7
-73
lines changed

4 files changed

+7
-73
lines changed
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
import codeql.rust.elements.internal.ExtractorStep
22

3-
private class Step instanceof ExtractorStep {
4-
string toString() {
5-
result = super.getAction() + "(" + this.getFilePath() + ")"
6-
or
7-
not super.hasFile() and result = super.getAction()
8-
}
9-
10-
private string getFilePath() {
11-
exists(File file | file = super.getFile() |
12-
exists(file.getRelativePath()) and result = file.getAbsolutePath()
13-
or
14-
not exists(file.getRelativePath()) and result = "/" + file.getBaseName()
15-
)
16-
}
17-
18-
predicate hasLocationInfo(
19-
string filepath, int startline, int startcolumn, int endline, int endcolumn
20-
) {
21-
super.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
22-
filepath = this.getFilePath()
23-
}
24-
}
25-
26-
from Step step
3+
from ExtractorStep step
4+
where not step.getAction() = ["ParseLibrary", "ExtractLibrary"]
275
select step
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
import codeql.rust.elements.internal.ExtractorStep
22

3-
private class Step instanceof ExtractorStep {
4-
string toString() {
5-
result = super.getAction() + "(" + this.getFilePath() + ")"
6-
or
7-
not super.hasFile() and result = super.getAction()
8-
}
9-
10-
private string getFilePath() {
11-
exists(File file | file = super.getFile() |
12-
exists(file.getRelativePath()) and result = file.getAbsolutePath()
13-
or
14-
not exists(file.getRelativePath()) and result = "/" + file.getBaseName()
15-
)
16-
}
17-
18-
predicate hasLocationInfo(
19-
string filepath, int startline, int startcolumn, int endline, int endcolumn
20-
) {
21-
super.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
22-
filepath = this.getFilePath()
23-
}
24-
}
25-
26-
from Step step
3+
from ExtractorStep step
4+
where not step.getAction() = ["ParseLibrary", "ExtractLibrary"]
275
select step
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Item i, MacroItems items, int index, Item expanded
4-
where i.getAttributeMacroExpansion() = items and items.getItem(index) = expanded
4+
where i.fromSource() and i.getAttributeMacroExpansion() = items and items.getItem(index) = expanded
55
select i, index, expanded
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
import codeql.rust.elements.internal.ExtractorStep
22

3-
private class Step instanceof ExtractorStep {
4-
string toString() {
5-
result = super.getAction() + "(" + this.getFilePath() + ")"
6-
or
7-
not super.hasFile() and result = super.getAction()
8-
}
9-
10-
private string getFilePath() {
11-
exists(File file | file = super.getFile() |
12-
exists(file.getRelativePath()) and result = file.getAbsolutePath()
13-
or
14-
not exists(file.getRelativePath()) and result = "/" + file.getBaseName()
15-
)
16-
}
17-
18-
predicate hasLocationInfo(
19-
string filepath, int startline, int startcolumn, int endline, int endcolumn
20-
) {
21-
super.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
22-
filepath = this.getFilePath()
23-
}
24-
}
25-
26-
from Step step
3+
from ExtractorStep step
4+
where not step.getAction() = ["ParseLibrary", "ExtractLibrary"]
275
select step

0 commit comments

Comments
 (0)