Auto merge of #1440 - RalfJung:wtf8, r=RalfJung

test WTF8 encoding corner cases

This adds a Miri-side test for https://github.com/rust-lang/rust/issues/72760.

Blocked on https://github.com/rust-lang/rust/pull/72683.
This commit is contained in:
bors 2020-05-31 23:15:23 +00:00
commit a8df047f5c
2 changed files with 24 additions and 1 deletions

View File

@ -1 +1 @@
b6fa392238a459c29a47e2cf824d79a49a8ba039
5fd2f06e99a985dd896684cb2c9f8c7090eca1ab

23
tests/run-pass/wtf8.rs Normal file
View File

@ -0,0 +1,23 @@
// 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();
}