diff options
| author | Brian Anderson <banderson@mozilla.com> | 2014-10-08 17:40:31 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2014-11-21 13:17:09 -0800 |
| commit | f6607a20c4abbd03a806c1320d059e0911dd0cdb (patch) | |
| tree | 610597e4174dbdbfe528da61f02e56f5c212b959 /src/libcoretest | |
| parent | 0150fa4b1b3e30b1f763905bd1af2d2ccd73c47e (diff) | |
| download | rust-f6607a20c4abbd03a806c1320d059e0911dd0cdb.tar.gz rust-f6607a20c4abbd03a806c1320d059e0911dd0cdb.zip | |
core: Add Char::len_utf16
Missing method to pair with len_utf8.
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/char.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index 2d5ca983fec..507ddf65e55 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -198,6 +198,14 @@ fn test_encode_utf16() { } #[test] +fn test_len_utf16() { + assert!('x'.len_utf16() == 1); + assert!('\u00e9'.len_utf16() == 1); + assert!('\ua66e'.len_utf16() == 1); + assert!('\U0001f4a9'.len_utf16() == 2); +} + +#[test] fn test_width() { assert_eq!('\x00'.width(false),Some(0)); assert_eq!('\x00'.width(true),Some(0)); |
