mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
C++: Add a test for SuccessfullyExtractedFiles.ql and friends.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| 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 |
|
||||
| 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 |
|
||||
@@ -0,0 +1 @@
|
||||
Diagnostics/Internal/ExtractionErrors.ql
|
||||
@@ -0,0 +1,2 @@
|
||||
| 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 |
|
||||
| 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 |
|
||||
@@ -0,0 +1 @@
|
||||
Diagnostics/ExtractionWarnings.ql
|
||||
@@ -0,0 +1 @@
|
||||
Diagnostics/FailedExtractorInvocations.ql
|
||||
6
cpp/ql/test/query-tests/Diagnostics/Info.expected
Normal file
6
cpp/ql/test/query-tests/Diagnostics/Info.expected
Normal file
@@ -0,0 +1,6 @@
|
||||
| containserror.cpp:0:0:0:0 | containserror.cpp | query-tests/Diagnostics/containserror.cpp | fromSource, normalTermination |
|
||||
| containswarning.cpp:0:0:0:0 | containswarning.cpp | query-tests/Diagnostics/containswarning.cpp | fromSource, normalTermination |
|
||||
| doesnotcompile.cpp:0:0:0:0 | doesnotcompile.cpp | query-tests/Diagnostics/doesnotcompile.cpp | ExtractionProblem (severity 1), fromSource, normalTermination |
|
||||
| file://:0:0:0:0 | | | |
|
||||
| header.h:0:0:0:0 | header.h | query-tests/Diagnostics/header.h | fromSource |
|
||||
| successful.cpp:0:0:0:0 | successful.cpp | query-tests/Diagnostics/successful.cpp | fromSource, normalTermination |
|
||||
17
cpp/ql/test/query-tests/Diagnostics/Info.ql
Normal file
17
cpp/ql/test/query-tests/Diagnostics/Info.ql
Normal file
@@ -0,0 +1,17 @@
|
||||
import cpp
|
||||
import Diagnostics.ExtractionProblems
|
||||
|
||||
string describe(File f) {
|
||||
exists(ExtractionProblem e | e.getFile() = f |
|
||||
result = "ExtractionProblem (severity " + e.getSeverity().toString() + ")"
|
||||
)
|
||||
or
|
||||
f.fromSource() and result = "fromSource"
|
||||
or
|
||||
exists(Compilation c | c.getAFileCompiled() = f |
|
||||
(c.normalTermination() and result = "normalTermination")
|
||||
)
|
||||
}
|
||||
|
||||
from File f
|
||||
select f, concat(f.getRelativePath(), ", "), concat(describe(f), ", ")
|
||||
@@ -0,0 +1,4 @@
|
||||
| containserror.cpp:0:0:0:0 | containserror.cpp | File successfully extracted. |
|
||||
| containswarning.cpp:0:0:0:0 | containswarning.cpp | File successfully extracted. |
|
||||
| header.h:0:0:0:0 | header.h | File successfully extracted. |
|
||||
| successful.cpp:0:0:0:0 | successful.cpp | File successfully extracted. |
|
||||
@@ -0,0 +1 @@
|
||||
Diagnostics/SuccessfullyExtractedFiles.ql
|
||||
5
cpp/ql/test/query-tests/Diagnostics/containserror.cpp
Normal file
5
cpp/ql/test/query-tests/Diagnostics/containserror.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// semmle-extractor-options: --expect_errors
|
||||
|
||||
void containserror() {
|
||||
#error An error!
|
||||
}
|
||||
4
cpp/ql/test/query-tests/Diagnostics/containswarning.cpp
Normal file
4
cpp/ql/test/query-tests/Diagnostics/containswarning.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
void containswarning() {
|
||||
#warning A warning.
|
||||
}
|
||||
5
cpp/ql/test/query-tests/Diagnostics/doesnotcompile.cpp
Normal file
5
cpp/ql/test/query-tests/Diagnostics/doesnotcompile.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// semmle-extractor-options: --expect_errors
|
||||
|
||||
void doesnotcompile() {
|
||||
This is not correct C/C++ code.
|
||||
}
|
||||
2
cpp/ql/test/query-tests/Diagnostics/header.h
Normal file
2
cpp/ql/test/query-tests/Diagnostics/header.h
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
// a header file
|
||||
5
cpp/ql/test/query-tests/Diagnostics/successful.cpp
Normal file
5
cpp/ql/test/query-tests/Diagnostics/successful.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
#include "header.h"
|
||||
|
||||
void successful() {
|
||||
}
|
||||
Reference in New Issue
Block a user