Skip to content

Commit 2eba3db

Browse files
committed
C++: Add a test for SuccessfullyExtractedFiles.ql and friends.
1 parent 24855dd commit 2eba3db

15 files changed

+56
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| doesnotcompile.cpp:4:2:4:2 | Recoverable extraction error: identifier 'This' is undefined | Extraction failed in doesnotcompile.cpp with error "doesnotcompile.cpp", line 4: error: identifier "This" is undefined\n \tThis is not correct C/C++ code.\n \t^\n\n | 2 |
2+
| doesnotcompile.cpp:4:10:4:10 | Recoverable extraction error: expected a ';' | Extraction failed in doesnotcompile.cpp with error "doesnotcompile.cpp", line 4: error: expected a ";"\n \tThis is not correct C/C++ code.\n \t ^\n\n | 2 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Diagnostics/Internal/ExtractionErrors.ql
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| doesnotcompile.cpp:4:2:4:2 | Recoverable extraction error: identifier 'This' is undefined | Extraction failed in doesnotcompile.cpp with warning "doesnotcompile.cpp", line 4: error: identifier "This" is undefined\n \tThis is not correct C/C++ code.\n \t^\n\n | 1 |
2+
| doesnotcompile.cpp:4:10:4:10 | Recoverable extraction error: expected a ';' | Extraction failed in doesnotcompile.cpp with warning "doesnotcompile.cpp", line 4: error: expected a ";"\n \tThis is not correct C/C++ code.\n \t ^\n\n | 1 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Diagnostics/ExtractionWarnings.ql

cpp/ql/test/query-tests/Diagnostics/FailedExtractorInvocations.expected

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Diagnostics/FailedExtractorInvocations.ql
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| containserror.cpp:0:0:0:0 | containserror.cpp | query-tests/Diagnostics/containserror.cpp | fromSource, normalTermination |
2+
| containswarning.cpp:0:0:0:0 | containswarning.cpp | query-tests/Diagnostics/containswarning.cpp | fromSource, normalTermination |
3+
| doesnotcompile.cpp:0:0:0:0 | doesnotcompile.cpp | query-tests/Diagnostics/doesnotcompile.cpp | ExtractionProblem (severity 1), fromSource, normalTermination |
4+
| file://:0:0:0:0 | | | |
5+
| header.h:0:0:0:0 | header.h | query-tests/Diagnostics/header.h | fromSource |
6+
| successful.cpp:0:0:0:0 | successful.cpp | query-tests/Diagnostics/successful.cpp | fromSource, normalTermination |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import cpp
2+
import Diagnostics.ExtractionProblems
3+
4+
string describe(File f) {
5+
exists(ExtractionProblem e | e.getFile() = f |
6+
result = "ExtractionProblem (severity " + e.getSeverity().toString() + ")"
7+
)
8+
or
9+
f.fromSource() and result = "fromSource"
10+
or
11+
exists(Compilation c | c.getAFileCompiled() = f |
12+
(c.normalTermination() and result = "normalTermination")
13+
)
14+
}
15+
16+
from File f
17+
select f, concat(f.getRelativePath(), ", "), concat(describe(f), ", ")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| containserror.cpp:0:0:0:0 | containserror.cpp | File successfully extracted. |
2+
| containswarning.cpp:0:0:0:0 | containswarning.cpp | File successfully extracted. |
3+
| header.h:0:0:0:0 | header.h | File successfully extracted. |
4+
| successful.cpp:0:0:0:0 | successful.cpp | File successfully extracted. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Diagnostics/SuccessfullyExtractedFiles.ql

0 commit comments

Comments
 (0)