diff options
Diffstat (limited to 'vendor/cstr/tests/pass/const.rs')
-rw-r--r-- | vendor/cstr/tests/pass/const.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/cstr/tests/pass/const.rs b/vendor/cstr/tests/pass/const.rs new file mode 100644 index 000000000..ae8647b95 --- /dev/null +++ b/vendor/cstr/tests/pass/const.rs @@ -0,0 +1,10 @@ +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()); +} |