diff options
| author | bors <bors@rust-lang.org> | 2020-05-29 23:43:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-29 23:43:20 +0000 |
| commit | 0e9e4083100aa3ebf09b8f1ace0348cb37475eb9 (patch) | |
| tree | 1bb8b3fa49e034b12057f85edfa1e7ac0f5dda74 /src/libcore/tests | |
| parent | 4bd32c98047a809ba5fd1fac2aa044638e5f2105 (diff) | |
| parent | 37894559abd67dd9544f2d66b0e117573e38119c (diff) | |
| download | rust-0e9e4083100aa3ebf09b8f1ace0348cb37475eb9.tar.gz rust-0e9e4083100aa3ebf09b8f1ace0348cb37475eb9.zip | |
Auto merge of #72756 - RalfJung:rollup-tbjmtx2, r=RalfJung
Rollup of 9 pull requests Successful merges: - #67460 (Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes) - #71095 (impl From<[T; N]> for Box<[T]>) - #71500 (Make pointer offset methods/intrinsics const) - #71804 (linker: Support `-static-pie` and `-static -shared`) - #71862 (Implement RFC 2585: unsafe blocks in unsafe fn) - #72103 (borrowck `DefId` -> `LocalDefId`) - #72407 (Various minor improvements to Ipv6Addr::Display) - #72413 (impl Step for char (make Range*<char> iterable)) - #72439 (NVPTX support for new asm!) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore/tests')
| -rw-r--r-- | src/libcore/tests/iter.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index 0265235a65a..ab4f4aa7c73 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1957,6 +1957,18 @@ fn test_range() { } #[test] +fn test_char_range() { + use std::char; + assert!(('\0'..=char::MAX).eq((0..=char::MAX as u32).filter_map(char::from_u32))); + assert!(('\0'..=char::MAX).rev().eq((0..=char::MAX as u32).filter_map(char::from_u32).rev())); + + assert_eq!(('\u{D7FF}'..='\u{E000}').count(), 2); + assert_eq!(('\u{D7FF}'..='\u{E000}').size_hint(), (2, Some(2))); + assert_eq!(('\u{D7FF}'..'\u{E000}').count(), 1); + assert_eq!(('\u{D7FF}'..'\u{E000}').size_hint(), (1, Some(1))); +} + +#[test] fn test_range_exhaustion() { let mut r = 10..10; assert!(r.is_empty()); |
