about summary refs log tree commit diff
path: root/src/libcoretest/char.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcoretest/char.rs')
-rw-r--r--src/libcoretest/char.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs
index ba8918fc6cb..41fd742c9e0 100644
--- a/src/libcoretest/char.rs
+++ b/src/libcoretest/char.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::char;
+
 #[test]
 fn test_is_lowercase() {
     assert!('a'.is_lowercase());
@@ -213,7 +215,10 @@ fn test_len_utf16() {
 #[test]
 fn test_decode_utf16() {
     fn check(s: &[u16], expected: &[Result<char, u16>]) {
-        assert_eq!(::std::char::decode_utf16(s.iter().cloned()).collect::<Vec<_>>(), expected);
+        let v = char::decode_utf16(s.iter().cloned())
+                     .map(|r| r.map_err(|e| e.unpaired_surrogate()))
+                     .collect::<Vec<_>>();
+        assert_eq!(v, expected);
     }
     check(&[0xD800, 0x41, 0x42], &[Err(0xD800), Ok('A'), Ok('B')]);
     check(&[0xD800, 0], &[Err(0xD800), Ok('\0')]);