1
0
Fork 0
firefox/third_party/rust/cstr/tests/pass/const.rs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

10 lines
268 B
Rust

use cstr::cstr;
use std::ffi::CStr;
const FOO: &CStr = cstr!(b"foo\xffbar");
static BAR: &CStr = cstr!("bar");
fn main() {
assert_eq!(FOO, CStr::from_bytes_with_nul(b"foo\xffbar\0").unwrap());
assert_eq!(BAR, CStr::from_bytes_with_nul(b"bar\0").unwrap());
}