restore tests accidentally removed in #30182

This commit is contained in:
Tamir Duberstein 2015-12-12 08:13:43 -05:00
parent 35b6461b6e
commit 722905fda0
3 changed files with 22 additions and 0 deletions

View File

@ -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};

View File

@ -866,6 +866,17 @@ fn test_vec_default() {
t!(Vec<i32>);
}
#[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() {

View File

@ -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> = 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;