rust/tests/run-pass/wtf8.rs
2020-06-01 01:12:31 +02:00

24 lines
592 B
Rust

// ignore-linux: tests Windows-only APIs
// ignore-macos: tests Windows-only APIs
use std::os::windows::ffi::{OsStrExt, OsStringExt};
use std::ffi::{OsStr, OsString};
fn test1() {
let base = "a\té \u{7f}💩\r";
let mut base: Vec<u16> = OsStr::new(base).encode_wide().collect();
base.push(0xD800);
let _res = OsString::from_wide(&base);
}
fn test2() {
let mut base: Vec<u16> = OsStr::new("").encode_wide().collect();
base.push(0xD83D);
let mut _res: Vec<u16> = OsString::from_wide(&base).encode_wide().collect();
}
fn main() {
test1();
test2();
}