Skip to content

Commit 722d54b

Browse files
committed
(c2rust-analyze/tests) Add tests for string literals and casts. They're cfged off as they're not yet supported.
1 parent 2a9fa7b commit 722d54b

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

c2rust-analyze/tests/analyze.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ use common::Analyze;
22

33
pub mod common;
44

5+
#[test]
6+
fn string_literals() {
7+
Analyze::new().run("tests/analyze/string_literals.rs");
8+
}
9+
10+
#[test]
11+
fn string_casts() {
12+
Analyze::new().run("tests/analyze/string_casts.rs");
13+
}
14+
515
#[test]
616
fn lighttpd_minimal() {
717
Analyze::new().run("../analysis/tests/lighttpd-minimal/src/main.rs");
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#[cfg(any())]
2+
fn cast_only(s: *const u8) {
3+
s as *const core::ffi::c_char;
4+
}
5+
6+
#[cfg(any())]
7+
fn cast_from_literal() {
8+
b"" as *const u8 as *const core::ffi::c_char;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#[cfg(any())]
2+
fn str() {
3+
"";
4+
}
5+
6+
#[cfg(any())]
7+
fn bstr() {
8+
b"";
9+
}

0 commit comments

Comments
 (0)