From 722905fda0bc7ef818bccc4b3f59641533269f36 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 12 Dec 2015 08:13:43 -0500 Subject: [PATCH] restore tests accidentally removed in #30182 --- src/libcollections/slice.rs | 3 +++ src/libcollectionstest/slice.rs | 11 +++++++++++ src/libcoretest/num/mod.rs | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 9bb5ec80819..9aab6c93c82 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -110,6 +110,9 @@ pub use core::slice::{Iter, IterMut}; pub use core::slice::{SplitMut, ChunksMut, Split}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut}; +#[unstable(feature = "slice_bytes", issue = "27740")] +#[allow(deprecated)] +pub use core::slice::bytes; #[stable(feature = "rust1", since = "1.0.0")] pub use core::slice::{from_raw_parts, from_raw_parts_mut}; diff --git a/src/libcollectionstest/slice.rs b/src/libcollectionstest/slice.rs index f86c016921e..80dcd48fbfa 100644 --- a/src/libcollectionstest/slice.rs +++ b/src/libcollectionstest/slice.rs @@ -866,6 +866,17 @@ fn test_vec_default() { t!(Vec); } +#[test] +fn test_bytes_set_memory() { + use std::slice::bytes::MutableByteVector; + + let mut values = [1,2,3,4,5]; + values[0..5].set_memory(0xAB); + assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]); + values[2..4].set_memory(0xFF); + assert!(values == [0xAB, 0xAB, 0xFF, 0xFF, 0xAB]); +} + #[test] #[should_panic] fn test_overflow_does_not_cause_segfault() { diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 09f2e326503..fba56db32bb 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -54,6 +54,14 @@ mod tests { use core::option::Option::{Some, None}; use core::num::Float; + #[test] + fn from_str_issue7588() { + let u : Option = u8::from_str_radix("1000", 10).ok(); + assert_eq!(u, None); + let s : Option = i16::from_str_radix("80000", 10).ok(); + assert_eq!(s, None); + } + #[test] fn test_int_from_str_overflow() { let mut i8_val: i8 = 127;