mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: Add a test for BuiltinTypes.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
| struct bool | |
|
||||||
|
| struct char | |
|
||||||
|
| struct f32 | FloatingPointType, NumericType |
|
||||||
|
| struct f64 | FloatingPointType, NumericType |
|
||||||
|
| struct i8 | IntegralType, NumericType |
|
||||||
|
| struct i16 | IntegralType, NumericType |
|
||||||
|
| struct i32 | IntegralType, NumericType |
|
||||||
|
| struct i64 | IntegralType, NumericType |
|
||||||
|
| struct i128 | IntegralType, NumericType |
|
||||||
|
| struct isize | IntegralType, NumericType |
|
||||||
|
| struct str | |
|
||||||
|
| struct u8 | IntegralType, NumericType |
|
||||||
|
| struct u16 | IntegralType, NumericType |
|
||||||
|
| struct u32 | IntegralType, NumericType |
|
||||||
|
| struct u64 | IntegralType, NumericType |
|
||||||
|
| struct u128 | IntegralType, NumericType |
|
||||||
|
| struct usize | IntegralType, NumericType |
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import rust
|
||||||
|
import codeql.rust.frameworks.stdlib.Builtins
|
||||||
|
import codeql.rust.internal.Type
|
||||||
|
|
||||||
|
string describe(BuiltinType t) {
|
||||||
|
(t instanceof NumericType and result = "NumericType")
|
||||||
|
or
|
||||||
|
(t instanceof IntegralType and result = "IntegralType")
|
||||||
|
or
|
||||||
|
(t instanceof FloatingPointType and result = "FloatingPointType")
|
||||||
|
}
|
||||||
|
|
||||||
|
from BuiltinType t
|
||||||
|
select t.toString(), concat(describe(t), ", ")
|
||||||
7
rust/ql/test/library-tests/elements/builtintypes/Cargo.lock
generated
Normal file
7
rust/ql/test/library-tests/elements/builtintypes/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "test"
|
||||||
|
version = "0.0.1"
|
||||||
5
rust/ql/test/library-tests/elements/builtintypes/test.rs
Normal file
5
rust/ql/test/library-tests/elements/builtintypes/test.rs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
// --- tests ---
|
||||||
|
|
||||||
|
fn test_types() {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user