std: silence some test warnings.

This commit is contained in:
Huon Wilson 2013-06-28 01:45:24 +10:00
parent d8087cae44
commit 366ca44cc8
6 changed files with 22 additions and 27 deletions

View file

@ -980,7 +980,6 @@ mod tests {
use super::*;
use prelude::*;
use iter;
use uint;
#[test]

View file

@ -92,14 +92,12 @@ fn test_tls_multitask() {
fn my_key(_x: @~str) { }
local_data_set(my_key, @~"parent data");
do task::spawn {
unsafe {
// TLS shouldn't carry over.
assert!(local_data_get(my_key).is_none());
local_data_set(my_key, @~"child data");
assert!(*(local_data_get(my_key).get()) ==
// TLS shouldn't carry over.
assert!(local_data_get(my_key).is_none());
local_data_set(my_key, @~"child data");
assert!(*(local_data_get(my_key).get()) ==
~"child data");
// should be cleaned up for us
}
// should be cleaned up for us
}
// Must work multiple times
assert!(*(local_data_get(my_key).get()) == ~"parent data");
@ -206,12 +204,11 @@ fn test_tls_cleanup_on_failure() {
local_data_set(str_key, @~"parent data");
local_data_set(box_key, @@());
do task::spawn {
unsafe { // spawn_linked
local_data_set(str_key, @~"string data");
local_data_set(box_key, @@());
local_data_set(int_key, @42);
fail!();
}
// spawn_linked
local_data_set(str_key, @~"string data");
local_data_set(box_key, @@());
local_data_set(int_key, @42);
fail!();
}
// Not quite nondeterministic.
local_data_set(int_key, @31337);

View file

@ -160,14 +160,14 @@ mod test {
let mut timer2 = TimerWatcher::new(&mut loop_);
do timer2.start(10, 0) |timer2, _| {
unsafe { *count_ptr += 1; }
*count_ptr += 1;
timer2.close(||());
// Restart the original timer
let mut timer = timer;
do timer.start(1, 0) |timer, _| {
unsafe { *count_ptr += 1; }
*count_ptr += 1;
timer.close(||());
}
}

View file

@ -2249,7 +2249,7 @@ mod tests {
assert!("" <= "");
assert!("" <= "foo");
assert!("foo" <= "foo");
assert!("foo" != ~"bar");
assert!("foo" != "bar");
}
#[test]
@ -3156,6 +3156,7 @@ mod tests {
#[test]
fn test_add() {
#[allow(unnecessary_allocation)];
macro_rules! t (
($s1:expr, $s2:expr, $e:expr) => {
assert_eq!($s1 + $s2, $e);

View file

@ -934,17 +934,15 @@ fn test_spawn_sched_blocking() {
let lock = testrt::rust_dbg_lock_create();
do spawn_sched(SingleThreaded) {
unsafe {
testrt::rust_dbg_lock_lock(lock);
testrt::rust_dbg_lock_lock(lock);
start_ch.send(());
start_ch.send(());
// Block the scheduler thread
testrt::rust_dbg_lock_wait(lock);
testrt::rust_dbg_lock_unlock(lock);
// Block the scheduler thread
testrt::rust_dbg_lock_wait(lock);
testrt::rust_dbg_lock_unlock(lock);
fin_ch.send(());
}
fin_ch.send(());
};
// Wait until the other task has its lock

View file

@ -3861,11 +3861,11 @@ mod tests {
fn test_vec_zero() {
use num::Zero;
macro_rules! t (
($ty:ty) => {
($ty:ty) => {{
let v: $ty = Zero::zero();
assert!(v.is_empty());
assert!(v.is_zero());
}
}}
);
t!(&[int]);