Skip to content

Commit ecce230

Browse files
test
1 parent fda509e commit ecce230

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

library/std/src/sys_common/wtf8/tests.rs

+9
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,12 @@ fn wtf8_utf8_boundary_between_surrogates() {
725725
string.push(CodePoint::from_u32(0xD800).unwrap());
726726
check_utf8_boundary(&string, 3);
727727
}
728+
729+
#[test]
730+
fn wtf8_not_utf8_isnt_utf8() {
731+
let mut string: Wtf8Buf = unsafe { Wtf8::from_bytes_unchecked(b"\xED\xA0\x80").to_owned() };
732+
assert_eq!(string.bytes, b"\xED\xA0\x80");
733+
assert!(!string.is_known_utf8);
734+
string.extend_from_slice(b"some utf-8");
735+
assert!(!string.is_known_utf8);
736+
}

0 commit comments

Comments
 (0)