std: silence warnings when compiling test.
This commit is contained in:
@@ -377,7 +377,6 @@ mod tests {
|
|||||||
use libc;
|
use libc;
|
||||||
use ptr;
|
use ptr;
|
||||||
use option::{Some, None};
|
use option::{Some, None};
|
||||||
use vec;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_str_multistring_parsing() {
|
fn test_str_multistring_parsing() {
|
||||||
@@ -440,7 +439,7 @@ mod tests {
|
|||||||
assert_eq!(*ptr::offset(buf, 0), 'f' as libc::c_char);
|
assert_eq!(*ptr::offset(buf, 0), 'f' as libc::c_char);
|
||||||
assert_eq!(*ptr::offset(buf, 1), 'o' as libc::c_char);
|
assert_eq!(*ptr::offset(buf, 1), 'o' as libc::c_char);
|
||||||
assert_eq!(*ptr::offset(buf, 2), 'o' as libc::c_char);
|
assert_eq!(*ptr::offset(buf, 2), 'o' as libc::c_char);
|
||||||
assert_eq!(*ptr::offset(buf, 3), 0xff);
|
assert_eq!(*ptr::offset(buf, 3), 0xff as i8);
|
||||||
assert_eq!(*ptr::offset(buf, 4), 0);
|
assert_eq!(*ptr::offset(buf, 4), 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -907,22 +907,14 @@ pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use io::native::file::{CFile, FileDesc};
|
use io::native::file::{CFile, FileDesc};
|
||||||
use io::fs;
|
|
||||||
use io;
|
use io;
|
||||||
use libc;
|
use libc;
|
||||||
use os;
|
use os;
|
||||||
use path::Path;
|
|
||||||
use rand;
|
|
||||||
use result::Ok;
|
use result::Ok;
|
||||||
use rt::rtio::RtioFileStream;
|
use rt::rtio::RtioFileStream;
|
||||||
|
|
||||||
fn tmpdir() -> Path {
|
|
||||||
let ret = os::tmpdir().join(format!("rust-{}", rand::random::<u32>()));
|
|
||||||
fs::mkdir(&ret, io::UserRWX);
|
|
||||||
ret
|
|
||||||
}
|
|
||||||
|
|
||||||
#[ignore(cfg(target_os = "freebsd"))] // hmm, maybe pipes have a tiny buffer
|
#[ignore(cfg(target_os = "freebsd"))] // hmm, maybe pipes have a tiny buffer
|
||||||
|
#[test]
|
||||||
fn test_file_desc() {
|
fn test_file_desc() {
|
||||||
// Run this test with some pipes so we don't have to mess around with
|
// Run this test with some pipes so we don't have to mess around with
|
||||||
// opening or closing files.
|
// opening or closing files.
|
||||||
@@ -949,6 +941,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[ignore(cfg(windows))] // apparently windows doesn't like tmpfile
|
#[ignore(cfg(windows))] // apparently windows doesn't like tmpfile
|
||||||
|
#[test]
|
||||||
fn test_cfile() {
|
fn test_cfile() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let f = libc::tmpfile();
|
let f = libc::tmpfile();
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_null_writer() {
|
fn test_null_writer() {
|
||||||
let mut s = NullWriter;
|
let mut s = NullWriter;
|
||||||
let mut buf = ~[0, 0, 0];
|
let buf = ~[0, 0, 0];
|
||||||
s.write(buf);
|
s.write(buf);
|
||||||
s.flush();
|
s.flush();
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ mod test {
|
|||||||
|
|
||||||
struct TestWriter;
|
struct TestWriter;
|
||||||
impl Writer for TestWriter {
|
impl Writer for TestWriter {
|
||||||
fn write(&mut self, buf: &[u8]) {
|
fn write(&mut self, _buf: &[u8]) {
|
||||||
unsafe { writes += 1 }
|
unsafe { writes += 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -438,6 +438,9 @@ mod tests {
|
|||||||
static int_key: Key<@int> = &Key;
|
static int_key: Key<@int> = &Key;
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
set(str_key, @~"string data");
|
set(str_key, @~"string data");
|
||||||
|
set(str_key, @~"string data 2");
|
||||||
|
set(box_key, @@());
|
||||||
|
set(box_key, @@());
|
||||||
set(int_key, @42);
|
set(int_key, @42);
|
||||||
// This could cause a segfault if overwriting-destruction is done
|
// This could cause a segfault if overwriting-destruction is done
|
||||||
// with the crazy polymorphic transmute rather than the provided
|
// with the crazy polymorphic transmute rather than the provided
|
||||||
|
|||||||
@@ -557,8 +557,6 @@ pub mod ptr_tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ptr_addition() {
|
fn test_ptr_addition() {
|
||||||
use vec::raw::*;
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let xs = ~[5, ..16];
|
let xs = ~[5, ..16];
|
||||||
let mut ptr = xs.as_ptr();
|
let mut ptr = xs.as_ptr();
|
||||||
|
|||||||
@@ -240,12 +240,14 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn floating_point_edge_cases() {
|
fn floating_point_edge_cases() {
|
||||||
// the test for exact equality is correct here.
|
// the test for exact equality is correct here.
|
||||||
assert!(ConstantRng(0xffff_ffff).gen::<f32>() != 1.0)
|
assert!(ConstantRng(0xffff_ffff).gen::<f32>() != 1.0)
|
||||||
assert!(ConstantRng(0xffff_ffff_ffff_ffff).gen::<f64>() != 1.0)
|
assert!(ConstantRng(0xffff_ffff_ffff_ffff).gen::<f64>() != 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn rand_open() {
|
fn rand_open() {
|
||||||
// this is unlikely to catch an incorrect implementation that
|
// this is unlikely to catch an incorrect implementation that
|
||||||
// generates exactly 0 or 1, but it keeps it sane.
|
// generates exactly 0 or 1, but it keeps it sane.
|
||||||
@@ -260,6 +262,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn rand_closed() {
|
fn rand_closed() {
|
||||||
let mut rng = task_rng();
|
let mut rng = task_rng();
|
||||||
for _ in range(0, 1_000) {
|
for _ in range(0, 1_000) {
|
||||||
|
|||||||
@@ -64,23 +64,25 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
|
|||||||
#[cfg(target_os = "freebsd")]
|
#[cfg(target_os = "freebsd")]
|
||||||
mod imp {
|
mod imp {
|
||||||
use cast;
|
use cast;
|
||||||
use libc;
|
#[cfg(not(test))] use libc;
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
use iter::Iterator;
|
use iter::Iterator;
|
||||||
use str;
|
#[cfg(not(test))] use str;
|
||||||
use unstable::finally::Finally;
|
use unstable::finally::Finally;
|
||||||
use unstable::mutex::{Mutex, MUTEX_INIT};
|
use unstable::mutex::{Mutex, MUTEX_INIT};
|
||||||
use util;
|
use util;
|
||||||
use vec;
|
#[cfg(not(test))] use vec;
|
||||||
|
|
||||||
static mut global_args_ptr: uint = 0;
|
static mut global_args_ptr: uint = 0;
|
||||||
static mut lock: Mutex = MUTEX_INIT;
|
static mut lock: Mutex = MUTEX_INIT;
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
pub unsafe fn init(argc: int, argv: **u8) {
|
pub unsafe fn init(argc: int, argv: **u8) {
|
||||||
let args = load_argc_and_argv(argc, argv);
|
let args = load_argc_and_argv(argc, argv);
|
||||||
put(args);
|
put(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
pub unsafe fn cleanup() {
|
pub unsafe fn cleanup() {
|
||||||
rtassert!(take().is_some());
|
rtassert!(take().is_some());
|
||||||
lock.destroy();
|
lock.destroy();
|
||||||
@@ -127,6 +129,7 @@ mod imp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copied from `os`.
|
// Copied from `os`.
|
||||||
|
#[cfg(not(test))]
|
||||||
unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> ~[~str] {
|
unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> ~[~str] {
|
||||||
vec::from_fn(argc as uint, |i| {
|
vec::from_fn(argc as uint, |i| {
|
||||||
str::raw::from_c_str(*(argv as **libc::c_char).offset(i as int))
|
str::raw::from_c_str(*(argv as **libc::c_char).offset(i as int))
|
||||||
@@ -163,8 +166,8 @@ mod imp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos", not(test))]
|
||||||
#[cfg(target_os = "win32")]
|
#[cfg(target_os = "win32", not(test))]
|
||||||
mod imp {
|
mod imp {
|
||||||
use option::Option;
|
use option::Option;
|
||||||
|
|
||||||
|
|||||||
@@ -395,6 +395,9 @@ pub unsafe fn record_sp_limit(limit: uint) {
|
|||||||
/// As with the setter, this function does not have a __morestack header and can
|
/// As with the setter, this function does not have a __morestack header and can
|
||||||
/// therefore be called in a "we're out of stack" situation.
|
/// therefore be called in a "we're out of stack" situation.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
// currently only called by `rust_stack_exhausted`, which doesn't
|
||||||
|
// exist in a test build.
|
||||||
|
#[cfg(not(test))]
|
||||||
pub unsafe fn get_sp_limit() -> uint {
|
pub unsafe fn get_sp_limit() -> uint {
|
||||||
return target_get_sp_limit();
|
return target_get_sp_limit();
|
||||||
|
|
||||||
|
|||||||
@@ -1341,6 +1341,8 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: #9407: xfail-test
|
// FIXME: #9407: xfail-test
|
||||||
|
#[ignore]
|
||||||
|
#[test]
|
||||||
fn dont_starve_1() {
|
fn dont_starve_1() {
|
||||||
stress_factor().times(|| {
|
stress_factor().times(|| {
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ use local_data;
|
|||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
use rt::borrowck::BorrowRecord;
|
use rt::borrowck::BorrowRecord;
|
||||||
use rt::borrowck;
|
use rt::borrowck;
|
||||||
use rt::context;
|
|
||||||
use rt::context::Context;
|
use rt::context::Context;
|
||||||
use rt::env;
|
use rt::env;
|
||||||
use rt::kill::Death;
|
use rt::kill::Death;
|
||||||
@@ -511,6 +510,7 @@ impl Unwinder {
|
|||||||
// irrelevant for documentation purposes.
|
// irrelevant for documentation purposes.
|
||||||
#[cfg(not(test))] // in testing, use the original libstd's version
|
#[cfg(not(test))] // in testing, use the original libstd's version
|
||||||
pub extern "C" fn rust_stack_exhausted() {
|
pub extern "C" fn rust_stack_exhausted() {
|
||||||
|
use rt::context;
|
||||||
use rt::in_green_task_context;
|
use rt::in_green_task_context;
|
||||||
use rt::task::Task;
|
use rt::task::Task;
|
||||||
use rt::local::Local;
|
use rt::local::Local;
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ mod tests {
|
|||||||
use task::spawn;
|
use task::spawn;
|
||||||
use unstable::running_on_valgrind;
|
use unstable::running_on_valgrind;
|
||||||
use io::native::file;
|
use io::native::file;
|
||||||
use io::{FileNotFound, OtherIoError, Reader, Writer, io_error};
|
use io::{FileNotFound, Reader, Writer, io_error};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_os="android"))] // FIXME(#10380)
|
#[cfg(not(target_os="android"))] // FIXME(#10380)
|
||||||
|
|||||||
@@ -2734,7 +2734,6 @@ mod tests {
|
|||||||
use option::{None, Some, Option};
|
use option::{None, Some, Option};
|
||||||
use ptr;
|
use ptr;
|
||||||
use str::*;
|
use str::*;
|
||||||
use vec;
|
|
||||||
use vec::{Vector, ImmutableVector, CopyableVector};
|
use vec::{Vector, ImmutableVector, CopyableVector};
|
||||||
use cmp::{TotalOrd, Less, Equal, Greater};
|
use cmp::{TotalOrd, Less, Equal, Greater};
|
||||||
use send_str::{SendStrOwned, SendStrStatic};
|
use send_str::{SendStrOwned, SendStrStatic};
|
||||||
|
|||||||
@@ -437,9 +437,6 @@ pub fn failing() -> bool {
|
|||||||
// !!! These tests are dangerous. If Something is buggy, they will hang, !!!
|
// !!! These tests are dangerous. If Something is buggy, they will hang, !!!
|
||||||
// !!! instead of exiting cleanly. This might wedge the buildbots. !!!
|
// !!! instead of exiting cleanly. This might wedge the buildbots. !!!
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
fn block_forever() { let (po, _ch) = Chan::<()>::new(); po.recv(); }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_unnamed_task() {
|
fn test_unnamed_task() {
|
||||||
use rt::test::run_in_uv_task;
|
use rt::test::run_in_uv_task;
|
||||||
@@ -507,11 +504,6 @@ fn test_run_basic() {
|
|||||||
po.recv();
|
po.recv();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
struct Wrapper {
|
|
||||||
f: Option<Chan<()>>
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_wrapper() {
|
fn test_add_wrapper() {
|
||||||
let (po, ch) = Chan::new();
|
let (po, ch) = Chan::new();
|
||||||
|
|||||||
@@ -2678,7 +2678,7 @@ impl<A> Extendable<A> for ~[A] {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use option::{None, Option, Some};
|
use option::{None, Some};
|
||||||
use mem;
|
use mem;
|
||||||
use vec::*;
|
use vec::*;
|
||||||
use cmp::*;
|
use cmp::*;
|
||||||
@@ -2688,22 +2688,8 @@ mod tests {
|
|||||||
|
|
||||||
fn square_ref(n: &uint) -> uint { square(*n) }
|
fn square_ref(n: &uint) -> uint { square(*n) }
|
||||||
|
|
||||||
fn is_three(n: &uint) -> bool { *n == 3u }
|
|
||||||
|
|
||||||
fn is_odd(n: &uint) -> bool { *n % 2u == 1u }
|
fn is_odd(n: &uint) -> bool { *n % 2u == 1u }
|
||||||
|
|
||||||
fn is_equal(x: &uint, y:&uint) -> bool { *x == *y }
|
|
||||||
|
|
||||||
fn square_if_odd_r(n: &uint) -> Option<uint> {
|
|
||||||
if *n % 2u == 1u { Some(*n * *n) } else { None }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn square_if_odd_v(n: uint) -> Option<uint> {
|
|
||||||
if n % 2u == 1u { Some(n * n) } else { None }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add(x: uint, y: &uint) -> uint { x + *y }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_unsafe_ptrs() {
|
fn test_unsafe_ptrs() {
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -2982,6 +2968,7 @@ mod tests {
|
|||||||
assert_eq!(g, None);
|
assert_eq!(g, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn test_swap_remove() {
|
fn test_swap_remove() {
|
||||||
let mut v = ~[1, 2, 3, 4, 5];
|
let mut v = ~[1, 2, 3, 4, 5];
|
||||||
let mut e = v.swap_remove(0);
|
let mut e = v.swap_remove(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user