diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2015-12-12 08:13:43 -0500 |
|---|---|---|
| committer | Tamir Duberstein <tamird@gmail.com> | 2015-12-13 01:02:12 -0500 |
| commit | 722905fda0bc7ef818bccc4b3f59641533269f36 (patch) | |
| tree | 005b082f036dad639468036bcce3932c5a086239 | |
| parent | 35b6461b6e7419ef5b81d02dfe53172219103764 (diff) | |
restore tests accidentally removed in #30182
| -rw-r--r-- | src/libcollections/slice.rs | 3 | ||||
| -rw-r--r-- | src/libcollectionstest/slice.rs | 11 | ||||
| -rw-r--r-- | src/libcoretest/num/mod.rs | 8 |
3 files changed, 22 insertions, 0 deletions
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 @@ -867,6 +867,17 @@ fn test_vec_default() { } #[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() { let mut v = vec![]; 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 @@ -55,6 +55,14 @@ mod tests { use core::num::Float; #[test] + fn from_str_issue7588() { + let u : Option<u8> = u8::from_str_radix("1000", 10).ok(); + assert_eq!(u, None); + let s : Option<i16> = i16::from_str_radix("80000", 10).ok(); + assert_eq!(s, None); + } + + #[test] fn test_int_from_str_overflow() { let mut i8_val: i8 = 127; assert_eq!("127".parse::<i8>().ok(), Some(i8_val)); |
