diff options
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/any.rs | 6 | ||||
| -rw-r--r-- | src/libcoretest/atomic.rs | 1 | ||||
| -rw-r--r-- | src/libcoretest/char.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/hash/sip.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/iter.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/ops.rs | 8 | ||||
| -rw-r--r-- | src/libcoretest/ptr.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/slice.rs | 22 | 
8 files changed, 30 insertions, 23 deletions
| diff --git a/src/libcoretest/any.rs b/src/libcoretest/any.rs index 7c832e90ed9..e9e2028dc61 100644 --- a/src/libcoretest/any.rs +++ b/src/libcoretest/any.rs @@ -113,10 +113,10 @@ fn any_downcast_mut() { #[test] fn any_fixed_vec() { - let test = [0u, ..8]; + let test = [0u; 8]; let test = &test as &Any; - assert!(test.is::<[uint, ..8]>()); - assert!(!test.is::<[uint, ..10]>()); + assert!(test.is::<[uint; 8]>()); + assert!(!test.is::<[uint; 10]>()); } diff --git a/src/libcoretest/atomic.rs b/src/libcoretest/atomic.rs index ab9c7ab9f11..1fee304a976 100644 --- a/src/libcoretest/atomic.rs +++ b/src/libcoretest/atomic.rs @@ -9,6 +9,7 @@ // except according to those terms. use core::atomic::*; +use core::atomic::Ordering::SeqCst; #[test] fn bool_() { diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index bed38f8c296..b931809e603 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -169,7 +169,7 @@ fn test_escape_unicode() { #[test] fn test_encode_utf8() { fn check(input: char, expect: &[u8]) { - let mut buf = [0u8, ..4]; + let mut buf = [0u8; 4]; let n = input.encode_utf8(buf.as_mut_slice()).unwrap_or(0); assert_eq!(buf[..n], expect); } @@ -183,7 +183,7 @@ fn test_encode_utf8() { #[test] fn test_encode_utf16() { fn check(input: char, expect: &[u16]) { - let mut buf = [0u16, ..2]; + let mut buf = [0u16; 2]; let n = input.encode_utf16(buf.as_mut_slice()).unwrap_or(0); assert_eq!(buf[..n], expect); } diff --git a/src/libcoretest/hash/sip.rs b/src/libcoretest/hash/sip.rs index 8801c2975c8..431f7e748f6 100644 --- a/src/libcoretest/hash/sip.rs +++ b/src/libcoretest/hash/sip.rs @@ -33,7 +33,7 @@ impl<'a, S: Writer> Hash<S> for Bytes<'a> { #[test] #[allow(unused_must_use)] fn test_siphash() { - let vecs : [[u8, ..8], ..64] = [ + let vecs : [[u8; 8]; 64] = [ [ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ], [ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ], [ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ], @@ -107,7 +107,7 @@ fn test_siphash() { let mut state_inc = SipState::new_with_keys(k0, k1); let mut state_full = SipState::new_with_keys(k0, k1); - fn to_hex_str(r: &[u8, ..8]) -> String { + fn to_hex_str(r: &[u8; 8]) -> String { let mut s = String::new(); for b in r.iter() { s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index dbbbaa5892c..d450e557383 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -19,7 +19,7 @@ use test::Bencher; #[test] fn test_lt() { - let empty: [int, ..0] = []; + let empty: [int; 0] = []; let xs = [1i,2,3]; let ys = [1i,2,0]; @@ -781,7 +781,7 @@ fn test_peekable_is_empty() { #[test] fn test_min_max() { - let v: [int, ..0] = []; + let v: [int; 0] = []; assert_eq!(v.iter().min_max(), NoElements); let v = [1i]; diff --git a/src/libcoretest/ops.rs b/src/libcoretest/ops.rs index a8889ce9e34..430188c7e43 100644 --- a/src/libcoretest/ops.rs +++ b/src/libcoretest/ops.rs @@ -9,7 +9,7 @@ // except according to those terms. use test::Bencher; -use core::ops::{Range, FullRange, RangeFrom}; +use core::ops::{Range, FullRange, RangeFrom, RangeTo}; // Overhead of dtors @@ -56,6 +56,12 @@ fn test_range_from() { } #[test] +fn test_range_to() { + // Not much to test. + let _ = RangeTo { end: 42u }; +} + +#[test] fn test_full_range() { // Not much to test. let _ = FullRange; diff --git a/src/libcoretest/ptr.rs b/src/libcoretest/ptr.rs index db3580e5d0c..162f75763de 100644 --- a/src/libcoretest/ptr.rs +++ b/src/libcoretest/ptr.rs @@ -165,8 +165,8 @@ fn test_ptr_subtraction() { #[test] fn test_set_memory() { - let mut xs = [0u8, ..20]; + let mut xs = [0u8; 20]; let ptr = xs.as_mut_ptr(); unsafe { set_memory(ptr, 5u8, xs.len()); } - assert!(xs == [5u8, ..20]); + assert!(xs == [5u8; 20]); } diff --git a/src/libcoretest/slice.rs b/src/libcoretest/slice.rs index 987da903211..9ef7d603059 100644 --- a/src/libcoretest/slice.rs +++ b/src/libcoretest/slice.rs @@ -8,30 +8,30 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::slice::BinarySearchResult::{Found, NotFound}; +use core::result::Result::{Ok, Err}; #[test] fn binary_search_not_found() { let b = [1i, 2, 4, 6, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&6)) == Found(3)); + assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3)); let b = [1i, 2, 4, 6, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&5)) == NotFound(3)); + assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3)); let b = [1i, 2, 4, 6, 7, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&6)) == Found(3)); + assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3)); let b = [1i, 2, 4, 6, 7, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&5)) == NotFound(3)); + assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3)); let b = [1i, 2, 4, 6, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&8)) == Found(4)); + assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(4)); let b = [1i, 2, 4, 6, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&7)) == NotFound(4)); + assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(4)); let b = [1i, 2, 4, 6, 7, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&8)) == Found(5)); + assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(5)); let b = [1i, 2, 4, 5, 6, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&7)) == NotFound(5)); + assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(5)); let b = [1i, 2, 4, 5, 6, 8, 9]; - assert!(b.binary_search(|v| v.cmp(&0)) == NotFound(0)); + assert!(b.binary_search_by(|v| v.cmp(&0)) == Err(0)); let b = [1i, 2, 4, 5, 6, 8]; - assert!(b.binary_search(|v| v.cmp(&9)) == NotFound(6)); + assert!(b.binary_search_by(|v| v.cmp(&9)) == Err(6)); } #[test] | 
