libstd: De-export libstd. rs=deexport
This commit is contained in:
parent
d0391c5b09
commit
f1ddb2a32c
@ -478,8 +478,6 @@ impl<T: Const Owned> &RWReadMode<T> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use arc::*;
|
||||
@ -493,7 +491,7 @@ mod tests {
|
||||
use core::vec;
|
||||
|
||||
#[test]
|
||||
fn manually_share_arc() {
|
||||
pub fn manually_share_arc() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let arc_v = arc::ARC(v);
|
||||
|
||||
@ -518,7 +516,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutex_arc_condvar() {
|
||||
pub fn test_mutex_arc_condvar() {
|
||||
let arc = ~MutexARC(false);
|
||||
let arc2 = ~arc.clone();
|
||||
let (p,c) = pipes::oneshot();
|
||||
@ -540,7 +538,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_arc_condvar_poison() {
|
||||
pub fn test_arc_condvar_poison() {
|
||||
let arc = ~MutexARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
let (p, c) = pipes::stream();
|
||||
@ -561,7 +559,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_mutex_arc_poison() {
|
||||
pub fn test_mutex_arc_poison() {
|
||||
let arc = ~MutexARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -574,7 +572,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_mutex_arc_unwrap_poison() {
|
||||
pub fn test_mutex_arc_unwrap_poison() {
|
||||
let arc = MutexARC(1);
|
||||
let arc2 = ~(&arc).clone();
|
||||
let (p, c) = pipes::stream();
|
||||
@ -589,7 +587,7 @@ mod tests {
|
||||
assert one == 1;
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_rw_arc_poison_wr() {
|
||||
pub fn test_rw_arc_poison_wr() {
|
||||
let arc = ~RWARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -602,7 +600,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_rw_arc_poison_ww() {
|
||||
pub fn test_rw_arc_poison_ww() {
|
||||
let arc = ~RWARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -615,7 +613,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_rw_arc_poison_dw() {
|
||||
pub fn test_rw_arc_poison_dw() {
|
||||
let arc = ~RWARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -630,7 +628,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rw_arc_no_poison_rr() {
|
||||
pub fn test_rw_arc_no_poison_rr() {
|
||||
let arc = ~RWARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -643,7 +641,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rw_arc_no_poison_rw() {
|
||||
pub fn test_rw_arc_no_poison_rw() {
|
||||
let arc = ~RWARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -656,7 +654,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rw_arc_no_poison_dr() {
|
||||
pub fn test_rw_arc_no_poison_dr() {
|
||||
let arc = ~RWARC(1);
|
||||
let arc2 = ~arc.clone();
|
||||
do task::try |move arc2| {
|
||||
@ -672,7 +670,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_rw_arc() {
|
||||
pub fn test_rw_arc() {
|
||||
let arc = ~RWARC(0);
|
||||
let arc2 = ~arc.clone();
|
||||
let (p,c) = pipes::stream();
|
||||
@ -709,7 +707,7 @@ mod tests {
|
||||
do arc.read |num| { assert *num == 10; }
|
||||
}
|
||||
#[test]
|
||||
fn test_rw_downgrade() {
|
||||
pub fn test_rw_downgrade() {
|
||||
// (1) A downgrader gets in write mode and does cond.wait.
|
||||
// (2) A writer gets in write mode, sets state to 42, and does signal.
|
||||
// (3) Downgrader wakes, sets state to 31337.
|
||||
|
@ -152,12 +152,10 @@ impl ~str: FromBase64 {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::str;
|
||||
|
||||
#[test]
|
||||
fn test_to_base64() {
|
||||
pub fn test_to_base64() {
|
||||
assert (~"").to_base64() == ~"";
|
||||
assert (~"f").to_base64() == ~"Zg==";
|
||||
assert (~"fo").to_base64() == ~"Zm8=";
|
||||
@ -168,7 +166,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_base64() {
|
||||
pub fn test_from_base64() {
|
||||
assert (~"").from_base64() == str::to_bytes(~"");
|
||||
assert (~"Zg==").from_base64() == str::to_bytes(~"f");
|
||||
assert (~"Zm8=").from_base64() == str::to_bytes(~"fo");
|
||||
|
@ -578,8 +578,6 @@ impl Bitv: ops::Index<uint,bool> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use bitv::*;
|
||||
@ -589,7 +587,7 @@ mod tests {
|
||||
use core::vec;
|
||||
|
||||
#[test]
|
||||
fn test_to_str() {
|
||||
pub fn test_to_str() {
|
||||
let zerolen = Bitv(0u, false);
|
||||
assert zerolen.to_str() == ~"";
|
||||
|
||||
@ -598,7 +596,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_0_elements() {
|
||||
pub fn test_0_elements() {
|
||||
let mut act;
|
||||
let mut exp;
|
||||
act = Bitv(0u, false);
|
||||
@ -607,7 +605,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_1_element() {
|
||||
pub fn test_1_element() {
|
||||
let mut act;
|
||||
act = Bitv(1u, false);
|
||||
assert act.eq_vec(~[0u]);
|
||||
@ -616,7 +614,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_2_elements() {
|
||||
pub fn test_2_elements() {
|
||||
let b = bitv::Bitv(2, false);
|
||||
b.set(0, true);
|
||||
b.set(1, false);
|
||||
@ -624,7 +622,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_10_elements() {
|
||||
pub fn test_10_elements() {
|
||||
let mut act;
|
||||
// all 0
|
||||
|
||||
@ -663,7 +661,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_31_elements() {
|
||||
pub fn test_31_elements() {
|
||||
let mut act;
|
||||
// all 0
|
||||
|
||||
@ -736,7 +734,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_32_elements() {
|
||||
pub fn test_32_elements() {
|
||||
let mut act;
|
||||
// all 0
|
||||
|
||||
@ -811,7 +809,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_33_elements() {
|
||||
pub fn test_33_elements() {
|
||||
let mut act;
|
||||
// all 0
|
||||
|
||||
@ -887,21 +885,21 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_equal_differing_sizes() {
|
||||
pub fn test_equal_differing_sizes() {
|
||||
let v0 = Bitv(10u, false);
|
||||
let v1 = Bitv(11u, false);
|
||||
assert !v0.equal(&v1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_equal_greatly_differing_sizes() {
|
||||
pub fn test_equal_greatly_differing_sizes() {
|
||||
let v0 = Bitv(10u, false);
|
||||
let v1 = Bitv(110u, false);
|
||||
assert !v0.equal(&v1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_equal_sneaky_small() {
|
||||
pub fn test_equal_sneaky_small() {
|
||||
let a = bitv::Bitv(1, false);
|
||||
a.set(0, true);
|
||||
|
||||
@ -912,7 +910,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_equal_sneaky_big() {
|
||||
pub fn test_equal_sneaky_big() {
|
||||
let a = bitv::Bitv(100, false);
|
||||
for uint::range(0, 100) |i| {
|
||||
a.set(i, true);
|
||||
@ -927,14 +925,14 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_bytes() {
|
||||
pub fn test_from_bytes() {
|
||||
let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]);
|
||||
let str = ~"10110110" + ~"00000000" + ~"11111111";
|
||||
assert bitv.to_str() == str;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_bytes() {
|
||||
pub fn test_to_bytes() {
|
||||
let bv = Bitv(3, true);
|
||||
bv.set(1, false);
|
||||
assert bv.to_bytes() == ~[0b10100000];
|
||||
@ -946,18 +944,18 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_bools() {
|
||||
pub fn test_from_bools() {
|
||||
assert from_bools([true, false, true, true]).to_str() == ~"1011";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_bools() {
|
||||
pub fn test_to_bools() {
|
||||
let bools = ~[false, false, true, false, false, true, true, false];
|
||||
assert from_bytes([0b00100110]).to_bools() == bools;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_small_difference() {
|
||||
pub fn test_small_difference() {
|
||||
let b1 = Bitv(3, false);
|
||||
let b2 = Bitv(3, false);
|
||||
b1.set(0, true);
|
||||
@ -971,7 +969,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_big_difference() {
|
||||
pub fn test_big_difference() {
|
||||
let b1 = Bitv(100, false);
|
||||
let b2 = Bitv(100, false);
|
||||
b1.set(0, true);
|
||||
|
@ -87,11 +87,10 @@ pub fn DuplexStream<T: Owned, U: Owned>()
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[legacy_exports];
|
||||
use comm::DuplexStream;
|
||||
|
||||
#[test]
|
||||
fn DuplexStream1() {
|
||||
pub fn DuplexStream1() {
|
||||
let (left, right) = DuplexStream();
|
||||
|
||||
left.send(~"abc");
|
||||
|
@ -17,14 +17,13 @@ use core::sys;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
extern mod rustrt {
|
||||
#[legacy_exports];
|
||||
unsafe fn debug_tydesc(td: *sys::TypeDesc);
|
||||
unsafe fn debug_opaque(td: *sys::TypeDesc, x: *());
|
||||
unsafe fn debug_box(td: *sys::TypeDesc, x: *());
|
||||
unsafe fn debug_tag(td: *sys::TypeDesc, x: *());
|
||||
unsafe fn debug_fn(td: *sys::TypeDesc, x: *());
|
||||
unsafe fn debug_ptrcast(td: *sys::TypeDesc, x: *()) -> *();
|
||||
unsafe fn rust_dbg_breakpoint();
|
||||
pub unsafe fn debug_tydesc(td: *sys::TypeDesc);
|
||||
pub unsafe fn debug_opaque(td: *sys::TypeDesc, x: *());
|
||||
pub unsafe fn debug_box(td: *sys::TypeDesc, x: *());
|
||||
pub unsafe fn debug_tag(td: *sys::TypeDesc, x: *());
|
||||
pub unsafe fn debug_fn(td: *sys::TypeDesc, x: *());
|
||||
pub unsafe fn debug_ptrcast(td: *sys::TypeDesc, x: *()) -> *();
|
||||
pub unsafe fn rust_dbg_breakpoint();
|
||||
}
|
||||
|
||||
pub fn debug_tydesc<T>() {
|
||||
|
@ -637,7 +637,6 @@ pub mod groups {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
use core::prelude::*;
|
||||
|
||||
use opt = getopts;
|
||||
@ -647,7 +646,7 @@ mod tests {
|
||||
use core::result::{Err, Ok};
|
||||
use core::result;
|
||||
|
||||
fn check_fail_type(f: Fail_, ft: FailType) {
|
||||
pub fn check_fail_type(f: Fail_, ft: FailType) {
|
||||
match f {
|
||||
ArgumentMissing(_) => assert ft == ArgumentMissing_,
|
||||
UnrecognizedOption(_) => assert ft == UnrecognizedOption_,
|
||||
@ -660,7 +659,7 @@ mod tests {
|
||||
|
||||
// Tests for reqopt
|
||||
#[test]
|
||||
fn test_reqopt_long() {
|
||||
pub fn test_reqopt_long() {
|
||||
let args = ~[~"--test=20"];
|
||||
let opts = ~[reqopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -674,7 +673,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_long_missing() {
|
||||
pub fn test_reqopt_long_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[reqopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -685,7 +684,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_long_no_arg() {
|
||||
pub fn test_reqopt_long_no_arg() {
|
||||
let args = ~[~"--test"];
|
||||
let opts = ~[reqopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -696,7 +695,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_long_multi() {
|
||||
pub fn test_reqopt_long_multi() {
|
||||
let args = ~[~"--test=20", ~"--test=30"];
|
||||
let opts = ~[reqopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -707,7 +706,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_short() {
|
||||
pub fn test_reqopt_short() {
|
||||
let args = ~[~"-t", ~"20"];
|
||||
let opts = ~[reqopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -721,7 +720,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_short_missing() {
|
||||
pub fn test_reqopt_short_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[reqopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -732,7 +731,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_short_no_arg() {
|
||||
pub fn test_reqopt_short_no_arg() {
|
||||
let args = ~[~"-t"];
|
||||
let opts = ~[reqopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -743,7 +742,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reqopt_short_multi() {
|
||||
pub fn test_reqopt_short_multi() {
|
||||
let args = ~[~"-t", ~"20", ~"-t", ~"30"];
|
||||
let opts = ~[reqopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -756,7 +755,7 @@ mod tests {
|
||||
|
||||
// Tests for optopt
|
||||
#[test]
|
||||
fn test_optopt_long() {
|
||||
pub fn test_optopt_long() {
|
||||
let args = ~[~"--test=20"];
|
||||
let opts = ~[optopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -770,7 +769,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_long_missing() {
|
||||
pub fn test_optopt_long_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[optopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -781,7 +780,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_long_no_arg() {
|
||||
pub fn test_optopt_long_no_arg() {
|
||||
let args = ~[~"--test"];
|
||||
let opts = ~[optopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -792,7 +791,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_long_multi() {
|
||||
pub fn test_optopt_long_multi() {
|
||||
let args = ~[~"--test=20", ~"--test=30"];
|
||||
let opts = ~[optopt(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -803,7 +802,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_short() {
|
||||
pub fn test_optopt_short() {
|
||||
let args = ~[~"-t", ~"20"];
|
||||
let opts = ~[optopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -817,7 +816,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_short_missing() {
|
||||
pub fn test_optopt_short_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[optopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -828,7 +827,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_short_no_arg() {
|
||||
pub fn test_optopt_short_no_arg() {
|
||||
let args = ~[~"-t"];
|
||||
let opts = ~[optopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -839,7 +838,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optopt_short_multi() {
|
||||
pub fn test_optopt_short_multi() {
|
||||
let args = ~[~"-t", ~"20", ~"-t", ~"30"];
|
||||
let opts = ~[optopt(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -852,7 +851,7 @@ mod tests {
|
||||
|
||||
// Tests for optflag
|
||||
#[test]
|
||||
fn test_optflag_long() {
|
||||
pub fn test_optflag_long() {
|
||||
let args = ~[~"--test"];
|
||||
let opts = ~[optflag(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -863,7 +862,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_long_missing() {
|
||||
pub fn test_optflag_long_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[optflag(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -874,7 +873,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_long_arg() {
|
||||
pub fn test_optflag_long_arg() {
|
||||
let args = ~[~"--test=20"];
|
||||
let opts = ~[optflag(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -888,7 +887,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_long_multi() {
|
||||
pub fn test_optflag_long_multi() {
|
||||
let args = ~[~"--test", ~"--test"];
|
||||
let opts = ~[optflag(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -899,7 +898,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_short() {
|
||||
pub fn test_optflag_short() {
|
||||
let args = ~[~"-t"];
|
||||
let opts = ~[optflag(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -910,7 +909,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_short_missing() {
|
||||
pub fn test_optflag_short_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[optflag(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -921,7 +920,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_short_arg() {
|
||||
pub fn test_optflag_short_arg() {
|
||||
let args = ~[~"-t", ~"20"];
|
||||
let opts = ~[optflag(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -936,7 +935,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflag_short_multi() {
|
||||
pub fn test_optflag_short_multi() {
|
||||
let args = ~[~"-t", ~"-t"];
|
||||
let opts = ~[optflag(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -948,7 +947,7 @@ mod tests {
|
||||
|
||||
// Tests for optflagmulti
|
||||
#[test]
|
||||
fn test_optflagmulti_short1() {
|
||||
pub fn test_optflagmulti_short1() {
|
||||
let args = ~[~"-v"];
|
||||
let opts = ~[optflagmulti(~"v")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -961,7 +960,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflagmulti_short2a() {
|
||||
pub fn test_optflagmulti_short2a() {
|
||||
let args = ~[~"-v", ~"-v"];
|
||||
let opts = ~[optflagmulti(~"v")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -974,7 +973,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflagmulti_short2b() {
|
||||
pub fn test_optflagmulti_short2b() {
|
||||
let args = ~[~"-vv"];
|
||||
let opts = ~[optflagmulti(~"v")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -987,7 +986,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflagmulti_long1() {
|
||||
pub fn test_optflagmulti_long1() {
|
||||
let args = ~[~"--verbose"];
|
||||
let opts = ~[optflagmulti(~"verbose")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1000,7 +999,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optflagmulti_long2() {
|
||||
pub fn test_optflagmulti_long2() {
|
||||
let args = ~[~"--verbose", ~"--verbose"];
|
||||
let opts = ~[optflagmulti(~"verbose")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1014,7 +1013,7 @@ mod tests {
|
||||
|
||||
// Tests for optmulti
|
||||
#[test]
|
||||
fn test_optmulti_long() {
|
||||
pub fn test_optmulti_long() {
|
||||
let args = ~[~"--test=20"];
|
||||
let opts = ~[optmulti(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1028,7 +1027,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_long_missing() {
|
||||
pub fn test_optmulti_long_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[optmulti(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1039,7 +1038,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_long_no_arg() {
|
||||
pub fn test_optmulti_long_no_arg() {
|
||||
let args = ~[~"--test"];
|
||||
let opts = ~[optmulti(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1050,7 +1049,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_long_multi() {
|
||||
pub fn test_optmulti_long_multi() {
|
||||
let args = ~[~"--test=20", ~"--test=30"];
|
||||
let opts = ~[optmulti(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1067,7 +1066,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_short() {
|
||||
pub fn test_optmulti_short() {
|
||||
let args = ~[~"-t", ~"20"];
|
||||
let opts = ~[optmulti(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1081,7 +1080,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_short_missing() {
|
||||
pub fn test_optmulti_short_missing() {
|
||||
let args = ~[~"blah"];
|
||||
let opts = ~[optmulti(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1092,7 +1091,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_short_no_arg() {
|
||||
pub fn test_optmulti_short_no_arg() {
|
||||
let args = ~[~"-t"];
|
||||
let opts = ~[optmulti(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1103,7 +1102,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optmulti_short_multi() {
|
||||
pub fn test_optmulti_short_multi() {
|
||||
let args = ~[~"-t", ~"20", ~"-t", ~"30"];
|
||||
let opts = ~[optmulti(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1120,7 +1119,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unrecognized_option_long() {
|
||||
pub fn test_unrecognized_option_long() {
|
||||
let args = ~[~"--untest"];
|
||||
let opts = ~[optmulti(~"t")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1131,7 +1130,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unrecognized_option_short() {
|
||||
pub fn test_unrecognized_option_short() {
|
||||
let args = ~[~"-t"];
|
||||
let opts = ~[optmulti(~"test")];
|
||||
let rs = getopts(args, opts);
|
||||
@ -1142,7 +1141,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_combined() {
|
||||
pub fn test_combined() {
|
||||
let args =
|
||||
~[~"prog", ~"free1", ~"-s", ~"20", ~"free2",
|
||||
~"--flag", ~"--long=30", ~"-f", ~"-m", ~"40",
|
||||
@ -1174,7 +1173,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi() {
|
||||
pub fn test_multi() {
|
||||
let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
|
||||
let opts = ~[optopt(~"e"), optopt(~"encrypt")];
|
||||
let matches = &match getopts(args, opts) {
|
||||
@ -1195,7 +1194,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nospace() {
|
||||
pub fn test_nospace() {
|
||||
let args = ~[~"-Lfoo", ~"-M."];
|
||||
let opts = ~[optmulti(~"L"), optmulti(~"M")];
|
||||
let matches = &match getopts(args, opts) {
|
||||
@ -1210,7 +1209,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_reqopt() {
|
||||
pub fn test_groups_reqopt() {
|
||||
let opt = groups::reqopt(~"b", ~"banana", ~"some bananas", ~"VAL");
|
||||
assert opt == OptGroup { short_name: ~"b",
|
||||
long_name: ~"banana",
|
||||
@ -1221,7 +1220,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_optopt() {
|
||||
pub fn test_groups_optopt() {
|
||||
let opt = groups::optopt(~"a", ~"apple", ~"some apples", ~"VAL");
|
||||
assert opt == OptGroup { short_name: ~"a",
|
||||
long_name: ~"apple",
|
||||
@ -1232,7 +1231,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_optflag() {
|
||||
pub fn test_groups_optflag() {
|
||||
let opt = groups::optflag(~"k", ~"kiwi", ~"some kiwis");
|
||||
assert opt == OptGroup { short_name: ~"k",
|
||||
long_name: ~"kiwi",
|
||||
@ -1243,7 +1242,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_optflagopt() {
|
||||
pub fn test_groups_optflagopt() {
|
||||
let opt = groups::optflagopt(~"p", ~"pineapple",
|
||||
~"some pineapples", ~"VAL");
|
||||
assert opt == OptGroup { short_name: ~"p",
|
||||
@ -1255,7 +1254,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_optmulti() {
|
||||
pub fn test_groups_optmulti() {
|
||||
let opt = groups::optmulti(~"l", ~"lime",
|
||||
~"some limes", ~"VAL");
|
||||
assert opt == OptGroup { short_name: ~"l",
|
||||
@ -1267,7 +1266,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_long_to_short() {
|
||||
pub fn test_groups_long_to_short() {
|
||||
let short = ~[reqopt(~"b"), reqopt(~"banana")];
|
||||
let verbose = groups::reqopt(~"b", ~"banana",
|
||||
~"some bananas", ~"VAL");
|
||||
@ -1276,7 +1275,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_getopts() {
|
||||
pub fn test_groups_getopts() {
|
||||
let short = ~[
|
||||
reqopt(~"b"), reqopt(~"banana"),
|
||||
optopt(~"a"), optopt(~"apple"),
|
||||
@ -1302,7 +1301,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_usage() {
|
||||
pub fn test_groups_usage() {
|
||||
let optgroups = ~[
|
||||
groups::reqopt(~"b", ~"banana", ~"Desc", ~"VAL"),
|
||||
groups::optopt(~"a", ~"012345678901234567890123456789",
|
||||
@ -1333,7 +1332,7 @@ Options:
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_usage_description_wrapping() {
|
||||
pub fn test_groups_usage_description_wrapping() {
|
||||
// indentation should be 24 spaces
|
||||
// lines wrap after 78: or rather descriptions wrap after 54
|
||||
|
||||
|
@ -156,15 +156,13 @@ pub pure fn each<T>(l: @List<T>, f: fn(&T) -> bool) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use list::*;
|
||||
use list;
|
||||
|
||||
use core::option;
|
||||
|
||||
#[test]
|
||||
fn test_is_empty() {
|
||||
pub fn test_is_empty() {
|
||||
let empty : @list::List<int> = from_vec(~[]);
|
||||
let full1 = from_vec(~[1]);
|
||||
let full2 = from_vec(~['r', 'u']);
|
||||
@ -175,7 +173,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_vec() {
|
||||
pub fn test_from_vec() {
|
||||
let l = from_vec(~[0, 1, 2]);
|
||||
|
||||
assert (head(l) == 0);
|
||||
@ -188,13 +186,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_vec_empty() {
|
||||
pub fn test_from_vec_empty() {
|
||||
let empty : @list::List<int> = from_vec(~[]);
|
||||
assert (empty == @list::Nil::<int>);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_foldl() {
|
||||
pub fn test_foldl() {
|
||||
fn add(a: &uint, b: &int) -> uint { return *a + (*b as uint); }
|
||||
let l = from_vec(~[0, 1, 2, 3, 4]);
|
||||
let empty = @list::Nil::<int>;
|
||||
@ -203,7 +201,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_foldl2() {
|
||||
pub fn test_foldl2() {
|
||||
fn sub(a: &int, b: &int) -> int {
|
||||
*a - *b
|
||||
}
|
||||
@ -212,14 +210,14 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_find_success() {
|
||||
pub fn test_find_success() {
|
||||
fn match_(i: &int) -> bool { return *i == 2; }
|
||||
let l = from_vec(~[0, 1, 2]);
|
||||
assert (list::find(l, match_) == option::Some(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_find_fail() {
|
||||
pub fn test_find_fail() {
|
||||
fn match_(_i: &int) -> bool { return false; }
|
||||
let l = from_vec(~[0, 1, 2]);
|
||||
let empty = @list::Nil::<int>;
|
||||
@ -228,7 +226,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_has() {
|
||||
pub fn test_has() {
|
||||
let l = from_vec(~[5, 8, 6]);
|
||||
let empty = @list::Nil::<int>;
|
||||
assert (list::has(l, 5));
|
||||
@ -238,7 +236,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_len() {
|
||||
pub fn test_len() {
|
||||
let l = from_vec(~[0, 1, 2]);
|
||||
let empty = @list::Nil::<int>;
|
||||
assert (list::len(l) == 3u);
|
||||
@ -246,7 +244,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_append() {
|
||||
pub fn test_append() {
|
||||
assert from_vec(~[1,2,3,4])
|
||||
== list::append(list::from_vec(~[1,2]), list::from_vec(~[3,4]));
|
||||
}
|
||||
|
@ -731,8 +731,6 @@ impl Url: to_bytes::IterBytes {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use net_url::*;
|
||||
@ -742,7 +740,7 @@ mod tests {
|
||||
use core::str;
|
||||
|
||||
#[test]
|
||||
fn test_split_char_first() {
|
||||
pub fn test_split_char_first() {
|
||||
let (u,v) = split_char_first(~"hello, sweet world", ',');
|
||||
assert u == ~"hello";
|
||||
assert v == ~" sweet world";
|
||||
@ -753,7 +751,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_authority() {
|
||||
pub fn test_get_authority() {
|
||||
let (u, h, p, r) = get_authority(
|
||||
"//user:pass@rust-lang.org/something").unwrap();
|
||||
assert u == Some(UserInfo::new(~"user", Some(~"pass")));
|
||||
@ -808,7 +806,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_path() {
|
||||
pub fn test_get_path() {
|
||||
let (p, r) = get_path("/something+%20orother", true).unwrap();
|
||||
assert p == ~"/something+ orother";
|
||||
assert r == ~"";
|
||||
@ -824,7 +822,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_parse() {
|
||||
pub fn test_url_parse() {
|
||||
let url = ~"http://user:pass@rust-lang.org/doc?s=v#something";
|
||||
|
||||
let up = from_str(url);
|
||||
@ -840,7 +838,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_parse_host_slash() {
|
||||
pub fn test_url_parse_host_slash() {
|
||||
let urlstr = ~"http://0.42.42.42/";
|
||||
let url = from_str(urlstr).unwrap();
|
||||
assert url.host == ~"0.42.42.42";
|
||||
@ -848,87 +846,87 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_with_underscores() {
|
||||
pub fn test_url_with_underscores() {
|
||||
let urlstr = ~"http://dotcom.com/file_name.html";
|
||||
let url = from_str(urlstr).unwrap();
|
||||
assert url.path == ~"/file_name.html";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_with_dashes() {
|
||||
pub fn test_url_with_dashes() {
|
||||
let urlstr = ~"http://dotcom.com/file-name.html";
|
||||
let url = from_str(urlstr).unwrap();
|
||||
assert url.path == ~"/file-name.html";
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_scheme() {
|
||||
pub fn test_no_scheme() {
|
||||
assert get_scheme("noschemehere.html").is_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_scheme_errors() {
|
||||
pub fn test_invalid_scheme_errors() {
|
||||
assert from_str("99://something").is_err();
|
||||
assert from_str("://something").is_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_full_url_parse_and_format() {
|
||||
pub fn test_full_url_parse_and_format() {
|
||||
let url = ~"http://user:pass@rust-lang.org/doc?s=v#something";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_userless_url_parse_and_format() {
|
||||
pub fn test_userless_url_parse_and_format() {
|
||||
let url = ~"http://rust-lang.org/doc?s=v#something";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_queryless_url_parse_and_format() {
|
||||
pub fn test_queryless_url_parse_and_format() {
|
||||
let url = ~"http://user:pass@rust-lang.org/doc#something";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_query_url_parse_and_format() {
|
||||
pub fn test_empty_query_url_parse_and_format() {
|
||||
let url = ~"http://user:pass@rust-lang.org/doc?#something";
|
||||
let should_be = ~"http://user:pass@rust-lang.org/doc#something";
|
||||
assert from_str(url).unwrap().to_str() == should_be;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fragmentless_url_parse_and_format() {
|
||||
pub fn test_fragmentless_url_parse_and_format() {
|
||||
let url = ~"http://user:pass@rust-lang.org/doc?q=v";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_minimal_url_parse_and_format() {
|
||||
pub fn test_minimal_url_parse_and_format() {
|
||||
let url = ~"http://rust-lang.org/doc";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scheme_host_only_url_parse_and_format() {
|
||||
pub fn test_scheme_host_only_url_parse_and_format() {
|
||||
let url = ~"http://rust-lang.org";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pathless_url_parse_and_format() {
|
||||
pub fn test_pathless_url_parse_and_format() {
|
||||
let url = ~"http://user:pass@rust-lang.org?q=v#something";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scheme_host_fragment_only_url_parse_and_format() {
|
||||
pub fn test_scheme_host_fragment_only_url_parse_and_format() {
|
||||
let url = ~"http://rust-lang.org#something";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_component_encoding() {
|
||||
pub fn test_url_component_encoding() {
|
||||
let url = ~"http://rust-lang.org/doc%20uments?ba%25d%20=%23%26%2B";
|
||||
let u = from_str(url).unwrap();
|
||||
assert u.path == ~"/doc uments";
|
||||
@ -936,13 +934,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_url_without_authority() {
|
||||
pub fn test_url_without_authority() {
|
||||
let url = ~"mailto:test@email.com";
|
||||
assert from_str(url).unwrap().to_str() == url;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_encode() {
|
||||
pub fn test_encode() {
|
||||
assert encode("") == ~"";
|
||||
assert encode("http://example.com") == ~"http://example.com";
|
||||
assert encode("foo bar% baz") == ~"foo%20bar%25%20baz";
|
||||
@ -970,7 +968,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_encode_component() {
|
||||
pub fn test_encode_component() {
|
||||
assert encode_component("") == ~"";
|
||||
assert encode_component("http://example.com") ==
|
||||
~"http%3A%2F%2Fexample.com";
|
||||
@ -998,7 +996,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_decode() {
|
||||
pub fn test_decode() {
|
||||
assert decode("") == ~"";
|
||||
assert decode("abc/def 123") == ~"abc/def 123";
|
||||
assert decode("abc%2Fdef%20123") == ~"abc%2Fdef 123";
|
||||
@ -1026,7 +1024,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_decode_component() {
|
||||
pub fn test_decode_component() {
|
||||
assert decode_component("") == ~"";
|
||||
assert decode_component("abc/def 123") == ~"abc/def 123";
|
||||
assert decode_component("abc%2Fdef%20123") == ~"abc/def 123";
|
||||
@ -1054,7 +1052,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_encode_form_urlencoded() {
|
||||
pub fn test_encode_form_urlencoded() {
|
||||
let mut m = LinearMap::new();
|
||||
assert encode_form_urlencoded(&m) == ~"";
|
||||
|
||||
@ -1072,7 +1070,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_decode_form_urlencoded() {
|
||||
pub fn test_decode_form_urlencoded() {
|
||||
// FIXME #4449: Commented out because this causes an ICE, but only
|
||||
// on FreeBSD
|
||||
/*
|
||||
|
@ -17,14 +17,13 @@ use core::str;
|
||||
use core::task;
|
||||
|
||||
extern mod rustrt {
|
||||
#[legacy_exports];
|
||||
unsafe fn linenoise(prompt: *c_char) -> *c_char;
|
||||
unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int;
|
||||
unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
|
||||
unsafe fn linenoiseHistorySave(file: *c_char) -> c_int;
|
||||
unsafe fn linenoiseHistoryLoad(file: *c_char) -> c_int;
|
||||
unsafe fn linenoiseSetCompletionCallback(callback: *u8);
|
||||
unsafe fn linenoiseAddCompletion(completions: *(), line: *c_char);
|
||||
pub unsafe fn linenoise(prompt: *c_char) -> *c_char;
|
||||
pub unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int;
|
||||
pub unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
|
||||
pub unsafe fn linenoiseHistorySave(file: *c_char) -> c_int;
|
||||
pub unsafe fn linenoiseHistoryLoad(file: *c_char) -> c_int;
|
||||
pub unsafe fn linenoiseSetCompletionCallback(callback: *u8);
|
||||
pub unsafe fn linenoiseAddCompletion(completions: *(), line: *c_char);
|
||||
}
|
||||
|
||||
/// Add a line to history
|
||||
|
@ -274,15 +274,13 @@ pub fn sha1() -> Sha1 {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use sha1;
|
||||
|
||||
use core::str;
|
||||
use core::vec;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
pub fn test() {
|
||||
unsafe {
|
||||
struct Test {
|
||||
input: ~str,
|
||||
@ -397,7 +395,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
@ -720,15 +720,13 @@ fn copy_vec<T: Copy>(dest: &[mut T], s1: uint,
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_qsort3 {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use sort::*;
|
||||
|
||||
use core::vec;
|
||||
|
||||
fn check_sort(v1: &[mut int], v2: &[mut int]) {
|
||||
pub fn check_sort(v1: &[mut int], v2: &[mut int]) {
|
||||
let len = vec::len::<int>(v1);
|
||||
quick_sort3::<int>(v1);
|
||||
let mut i = 0;
|
||||
@ -740,7 +738,7 @@ mod test_qsort3 {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
pub fn test() {
|
||||
{
|
||||
let v1 = ~[mut 3, 7, 4, 5, 2, 9, 5, 8];
|
||||
let v2 = ~[mut 2, 3, 4, 5, 5, 7, 8, 9];
|
||||
@ -767,8 +765,6 @@ mod test_qsort3 {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_qsort {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use sort::*;
|
||||
@ -776,7 +772,7 @@ mod test_qsort {
|
||||
use core::int;
|
||||
use core::vec;
|
||||
|
||||
fn check_sort(v1: &[mut int], v2: &[mut int]) {
|
||||
pub fn check_sort(v1: &[mut int], v2: &[mut int]) {
|
||||
let len = vec::len::<int>(v1);
|
||||
pure fn leual(a: &int, b: &int) -> bool { *a <= *b }
|
||||
quick_sort::<int>(v1, leual);
|
||||
@ -789,7 +785,7 @@ mod test_qsort {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
pub fn test() {
|
||||
{
|
||||
let v1 = ~[mut 3, 7, 4, 5, 2, 9, 5, 8];
|
||||
let v2 = ~[mut 2, 3, 4, 5, 5, 7, 8, 9];
|
||||
@ -815,7 +811,7 @@ mod test_qsort {
|
||||
|
||||
// Regression test for #750
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
pub fn test_simple() {
|
||||
let names = ~[mut 2, 1, 3];
|
||||
|
||||
let expected = ~[1, 2, 3];
|
||||
@ -835,15 +831,13 @@ mod test_qsort {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use sort::*;
|
||||
|
||||
use core::vec;
|
||||
|
||||
fn check_sort(v1: &[int], v2: &[int]) {
|
||||
pub fn check_sort(v1: &[int], v2: &[int]) {
|
||||
let len = vec::len::<int>(v1);
|
||||
pub pure fn le(a: &int, b: &int) -> bool { *a <= *b }
|
||||
let f = le;
|
||||
@ -857,7 +851,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
pub fn test() {
|
||||
{
|
||||
let v1 = ~[3, 7, 4, 5, 2, 9, 5, 8];
|
||||
let v2 = ~[2, 3, 4, 5, 5, 7, 8, 9];
|
||||
@ -874,7 +868,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_merge_sort_mutable() {
|
||||
pub fn test_merge_sort_mutable() {
|
||||
pub pure fn le(a: &int, b: &int) -> bool { *a <= *b }
|
||||
let v1 = ~[mut 3, 2, 1];
|
||||
let v2 = merge_sort(v1, le);
|
||||
@ -882,8 +876,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_merge_sort_stability()
|
||||
{
|
||||
pub fn test_merge_sort_stability() {
|
||||
// tjc: funny that we have to use parens
|
||||
pure fn ile(x: &(&static/str), y: &(&static/str)) -> bool
|
||||
{
|
||||
|
@ -708,8 +708,6 @@ impl &RWlockReadMode {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use sync::*;
|
||||
@ -726,19 +724,19 @@ mod tests {
|
||||
* Semaphore tests
|
||||
************************************************************************/
|
||||
#[test]
|
||||
fn test_sem_acquire_release() {
|
||||
pub fn test_sem_acquire_release() {
|
||||
let s = ~semaphore(1);
|
||||
s.acquire();
|
||||
s.release();
|
||||
s.acquire();
|
||||
}
|
||||
#[test]
|
||||
fn test_sem_basic() {
|
||||
pub fn test_sem_basic() {
|
||||
let s = ~semaphore(1);
|
||||
do s.access { }
|
||||
}
|
||||
#[test]
|
||||
fn test_sem_as_mutex() {
|
||||
pub fn test_sem_as_mutex() {
|
||||
let s = ~semaphore(1);
|
||||
let s2 = ~s.clone();
|
||||
do task::spawn |move s2| {
|
||||
@ -751,7 +749,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_sem_as_cvar() {
|
||||
pub fn test_sem_as_cvar() {
|
||||
/* Child waits and parent signals */
|
||||
let (p,c) = pipes::stream();
|
||||
let s = ~semaphore(0);
|
||||
@ -777,7 +775,7 @@ mod tests {
|
||||
c.send(());
|
||||
}
|
||||
#[test]
|
||||
fn test_sem_multi_resource() {
|
||||
pub fn test_sem_multi_resource() {
|
||||
// Parent and child both get in the critical section at the same
|
||||
// time, and shake hands.
|
||||
let s = ~semaphore(2);
|
||||
@ -796,7 +794,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_sem_runtime_friendly_blocking() {
|
||||
pub fn test_sem_runtime_friendly_blocking() {
|
||||
// Force the runtime to schedule two threads on the same sched_loop.
|
||||
// When one blocks, it should schedule the other one.
|
||||
do task::spawn_sched(task::ManualThreads(1)) {
|
||||
@ -821,7 +819,7 @@ mod tests {
|
||||
* Mutex tests
|
||||
************************************************************************/
|
||||
#[test]
|
||||
fn test_mutex_lock() {
|
||||
pub fn test_mutex_lock() {
|
||||
// Unsafely achieve shared state, and do the textbook
|
||||
// "load tmp = move ptr; inc tmp; store ptr <- tmp" dance.
|
||||
let (p,c) = pipes::stream();
|
||||
@ -852,7 +850,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_mutex_cond_wait() {
|
||||
pub fn test_mutex_cond_wait() {
|
||||
let m = ~Mutex();
|
||||
|
||||
// Child wakes up parent
|
||||
@ -884,7 +882,7 @@ mod tests {
|
||||
let _ = port.recv(); // Wait until child wakes up
|
||||
}
|
||||
#[cfg(test)]
|
||||
fn test_mutex_cond_broadcast_helper(num_waiters: uint) {
|
||||
pub fn test_mutex_cond_broadcast_helper(num_waiters: uint) {
|
||||
let m = ~Mutex();
|
||||
let mut ports = ~[];
|
||||
|
||||
@ -911,15 +909,15 @@ mod tests {
|
||||
for ports.each |port| { let _ = port.recv(); }
|
||||
}
|
||||
#[test]
|
||||
fn test_mutex_cond_broadcast() {
|
||||
pub fn test_mutex_cond_broadcast() {
|
||||
test_mutex_cond_broadcast_helper(12);
|
||||
}
|
||||
#[test]
|
||||
fn test_mutex_cond_broadcast_none() {
|
||||
pub fn test_mutex_cond_broadcast_none() {
|
||||
test_mutex_cond_broadcast_helper(0);
|
||||
}
|
||||
#[test]
|
||||
fn test_mutex_cond_no_waiter() {
|
||||
pub fn test_mutex_cond_no_waiter() {
|
||||
let m = ~Mutex();
|
||||
let m2 = ~m.clone();
|
||||
do task::try |move m| {
|
||||
@ -930,7 +928,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_mutex_killed_simple() {
|
||||
pub fn test_mutex_killed_simple() {
|
||||
// Mutex must get automatically unlocked if failed/killed within.
|
||||
let m = ~Mutex();
|
||||
let m2 = ~m.clone();
|
||||
@ -945,7 +943,7 @@ mod tests {
|
||||
do m.lock { }
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_mutex_killed_cond() {
|
||||
pub fn test_mutex_killed_cond() {
|
||||
// Getting killed during cond wait must not corrupt the mutex while
|
||||
// unwinding (e.g. double unlock).
|
||||
let m = ~Mutex();
|
||||
@ -971,7 +969,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_mutex_killed_broadcast() {
|
||||
pub fn test_mutex_killed_broadcast() {
|
||||
let m = ~Mutex();
|
||||
let m2 = ~m.clone();
|
||||
let (p,c) = pipes::stream();
|
||||
@ -1024,7 +1022,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_mutex_cond_signal_on_0() {
|
||||
pub fn test_mutex_cond_signal_on_0() {
|
||||
// Tests that signal_on(0) is equivalent to signal().
|
||||
let m = ~Mutex();
|
||||
do m.lock_cond |cond| {
|
||||
@ -1038,7 +1036,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_mutex_different_conds() {
|
||||
pub fn test_mutex_different_conds() {
|
||||
let result = do task::try {
|
||||
let m = ~mutex_with_condvars(2);
|
||||
let m2 = ~m.clone();
|
||||
@ -1059,7 +1057,7 @@ mod tests {
|
||||
assert result.is_err();
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_mutex_no_condvars() {
|
||||
pub fn test_mutex_no_condvars() {
|
||||
let result = do task::try {
|
||||
let m = ~mutex_with_condvars(0);
|
||||
do m.lock_cond |cond| { cond.wait(); }
|
||||
@ -1080,9 +1078,9 @@ mod tests {
|
||||
* Reader/writer lock tests
|
||||
************************************************************************/
|
||||
#[cfg(test)]
|
||||
enum RWlockMode { Read, Write, Downgrade, DowngradeRead }
|
||||
pub enum RWlockMode { Read, Write, Downgrade, DowngradeRead }
|
||||
#[cfg(test)]
|
||||
fn lock_rwlock_in_mode(x: &RWlock, mode: RWlockMode, blk: fn()) {
|
||||
pub fn lock_rwlock_in_mode(x: &RWlock, mode: RWlockMode, blk: fn()) {
|
||||
match mode {
|
||||
Read => x.read(blk),
|
||||
Write => x.write(blk),
|
||||
@ -1098,8 +1096,9 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
fn test_rwlock_exclusion(x: ~RWlock, mode1: RWlockMode,
|
||||
mode2: RWlockMode) {
|
||||
pub fn test_rwlock_exclusion(x: ~RWlock,
|
||||
mode1: RWlockMode,
|
||||
mode2: RWlockMode) {
|
||||
// Test mutual exclusion between readers and writers. Just like the
|
||||
// mutex mutual exclusion test, a ways above.
|
||||
let (p,c) = pipes::stream();
|
||||
@ -1129,22 +1128,24 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_readers_wont_modify_the_data() {
|
||||
pub fn test_rwlock_readers_wont_modify_the_data() {
|
||||
test_rwlock_exclusion(~RWlock(), Read, Write);
|
||||
test_rwlock_exclusion(~RWlock(), Write, Read);
|
||||
test_rwlock_exclusion(~RWlock(), Read, Downgrade);
|
||||
test_rwlock_exclusion(~RWlock(), Downgrade, Read);
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_writers_and_writers() {
|
||||
pub fn test_rwlock_writers_and_writers() {
|
||||
test_rwlock_exclusion(~RWlock(), Write, Write);
|
||||
test_rwlock_exclusion(~RWlock(), Write, Downgrade);
|
||||
test_rwlock_exclusion(~RWlock(), Downgrade, Write);
|
||||
test_rwlock_exclusion(~RWlock(), Downgrade, Downgrade);
|
||||
}
|
||||
#[cfg(test)]
|
||||
fn test_rwlock_handshake(x: ~RWlock, mode1: RWlockMode,
|
||||
mode2: RWlockMode, make_mode2_go_first: bool) {
|
||||
pub fn test_rwlock_handshake(x: ~RWlock,
|
||||
mode1: RWlockMode,
|
||||
mode2: RWlockMode,
|
||||
make_mode2_go_first: bool) {
|
||||
// Much like sem_multi_resource.
|
||||
let x2 = ~x.clone();
|
||||
let (p1,c1) = pipes::stream();
|
||||
@ -1173,7 +1174,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_readers_and_readers() {
|
||||
pub fn test_rwlock_readers_and_readers() {
|
||||
test_rwlock_handshake(~RWlock(), Read, Read, false);
|
||||
// The downgrader needs to get in before the reader gets in, otherwise
|
||||
// they cannot end up reading at the same time.
|
||||
@ -1182,7 +1183,7 @@ mod tests {
|
||||
// Two downgrade_reads can never both end up reading at the same time.
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_downgrade_unlock() {
|
||||
pub fn test_rwlock_downgrade_unlock() {
|
||||
// Tests that downgrade can unlock the lock in both modes
|
||||
let x = ~RWlock();
|
||||
do lock_rwlock_in_mode(x, Downgrade) { }
|
||||
@ -1192,12 +1193,12 @@ mod tests {
|
||||
test_rwlock_exclusion(move y, Write, Write);
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_read_recursive() {
|
||||
pub fn test_rwlock_read_recursive() {
|
||||
let x = ~RWlock();
|
||||
do x.read { do x.read { } }
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_cond_wait() {
|
||||
pub fn test_rwlock_cond_wait() {
|
||||
// As test_mutex_cond_wait above.
|
||||
let x = ~RWlock();
|
||||
|
||||
@ -1232,8 +1233,9 @@ mod tests {
|
||||
do x.read { } // Just for good measure
|
||||
}
|
||||
#[cfg(test)]
|
||||
fn test_rwlock_cond_broadcast_helper(num_waiters: uint, dg1: bool,
|
||||
dg2: bool) {
|
||||
pub fn test_rwlock_cond_broadcast_helper(num_waiters: uint,
|
||||
dg1: bool,
|
||||
dg2: bool) {
|
||||
// Much like the mutex broadcast test. Downgrade-enabled.
|
||||
fn lock_cond(x: &RWlock, downgrade: bool, blk: fn(c: &Condvar)) {
|
||||
if downgrade {
|
||||
@ -1270,7 +1272,7 @@ mod tests {
|
||||
for ports.each |port| { let _ = port.recv(); }
|
||||
}
|
||||
#[test]
|
||||
fn test_rwlock_cond_broadcast() {
|
||||
pub fn test_rwlock_cond_broadcast() {
|
||||
test_rwlock_cond_broadcast_helper(0, true, true);
|
||||
test_rwlock_cond_broadcast_helper(0, true, false);
|
||||
test_rwlock_cond_broadcast_helper(0, false, true);
|
||||
@ -1281,7 +1283,7 @@ mod tests {
|
||||
test_rwlock_cond_broadcast_helper(12, false, false);
|
||||
}
|
||||
#[cfg(test)] #[ignore(cfg(windows))]
|
||||
fn rwlock_kill_helper(mode1: RWlockMode, mode2: RWlockMode) {
|
||||
pub fn rwlock_kill_helper(mode1: RWlockMode, mode2: RWlockMode) {
|
||||
// Mutex must get automatically unlocked if failed/killed within.
|
||||
let x = ~RWlock();
|
||||
let x2 = ~x.clone();
|
||||
@ -1296,15 +1298,23 @@ mod tests {
|
||||
do lock_rwlock_in_mode(x, mode2) { }
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rwlock_reader_killed_writer() { rwlock_kill_helper(Read, Write); }
|
||||
pub fn test_rwlock_reader_killed_writer() {
|
||||
rwlock_kill_helper(Read, Write);
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rwlock_writer_killed_reader() { rwlock_kill_helper(Write,Read ); }
|
||||
pub fn test_rwlock_writer_killed_reader() {
|
||||
rwlock_kill_helper(Write,Read );
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rwlock_reader_killed_reader() { rwlock_kill_helper(Read, Read ); }
|
||||
pub fn test_rwlock_reader_killed_reader() {
|
||||
rwlock_kill_helper(Read, Read );
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rwlock_writer_killed_writer() { rwlock_kill_helper(Write,Write); }
|
||||
pub fn test_rwlock_writer_killed_writer() {
|
||||
rwlock_kill_helper(Write,Write);
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
fn test_rwlock_kill_downgrader() {
|
||||
pub fn test_rwlock_kill_downgrader() {
|
||||
rwlock_kill_helper(Downgrade, Read);
|
||||
rwlock_kill_helper(Read, Downgrade);
|
||||
rwlock_kill_helper(Downgrade, Write);
|
||||
@ -1319,7 +1329,7 @@ mod tests {
|
||||
rwlock_kill_helper(Downgrade, DowngradeRead);
|
||||
}
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_rwlock_downgrade_cant_swap() {
|
||||
pub fn test_rwlock_downgrade_cant_swap() {
|
||||
// Tests that you can't downgrade with a different rwlock's token.
|
||||
let x = ~RWlock();
|
||||
let y = ~RWlock();
|
||||
|
@ -38,8 +38,7 @@ use core::vec;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
extern mod rustrt {
|
||||
#[legacy_exports];
|
||||
unsafe fn rust_sched_threads() -> size_t;
|
||||
pub unsafe fn rust_sched_threads() -> size_t;
|
||||
}
|
||||
|
||||
// The name of a test. By convention this follows the rules for rust
|
||||
@ -437,8 +436,6 @@ fn calc_result(test: &TestDesc, task_succeeded: bool) -> TestResult {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use test::{TrFailed, TrIgnored, TrOk, filter_tests, parse_opts, TestDesc};
|
||||
use test::{TestOpts, run_test};
|
||||
|
||||
@ -448,7 +445,7 @@ mod tests {
|
||||
use core::vec;
|
||||
|
||||
#[test]
|
||||
fn do_not_run_ignored_tests() {
|
||||
pub fn do_not_run_ignored_tests() {
|
||||
fn f() { fail; }
|
||||
let desc = TestDesc {
|
||||
name: ~"whatever",
|
||||
@ -464,7 +461,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignored_tests_result_in_ignored() {
|
||||
pub fn ignored_tests_result_in_ignored() {
|
||||
fn f() { }
|
||||
let desc = TestDesc {
|
||||
name: ~"whatever",
|
||||
@ -481,7 +478,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
#[ignore(cfg(windows))]
|
||||
fn test_should_fail() {
|
||||
pub fn test_should_fail() {
|
||||
fn f() { fail; }
|
||||
let desc = TestDesc {
|
||||
name: ~"whatever",
|
||||
@ -497,7 +494,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_fail_but_succeeds() {
|
||||
pub fn test_should_fail_but_succeeds() {
|
||||
fn f() { }
|
||||
let desc = TestDesc {
|
||||
name: ~"whatever",
|
||||
@ -513,7 +510,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn first_free_arg_should_be_a_filter() {
|
||||
pub fn first_free_arg_should_be_a_filter() {
|
||||
let args = ~[~"progname", ~"filter"];
|
||||
let opts = match parse_opts(args) {
|
||||
either::Left(copy o) => o,
|
||||
@ -523,7 +520,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_ignored_flag() {
|
||||
pub fn parse_ignored_flag() {
|
||||
let args = ~[~"progname", ~"filter", ~"--ignored"];
|
||||
let opts = match parse_opts(args) {
|
||||
either::Left(copy o) => o,
|
||||
@ -533,7 +530,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filter_for_ignored_option() {
|
||||
pub fn filter_for_ignored_option() {
|
||||
// When we run ignored tests the test filter should filter out all the
|
||||
// unignored tests and flip the ignore flag on the rest to false
|
||||
|
||||
@ -565,7 +562,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sort_tests() {
|
||||
pub fn sort_tests() {
|
||||
let opts = TestOpts {
|
||||
filter: option::None,
|
||||
run_ignored: false,
|
||||
|
@ -24,17 +24,16 @@ const NSEC_PER_SEC: i32 = 1_000_000_000_i32;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
extern mod rustrt {
|
||||
#[legacy_exports]
|
||||
unsafe fn get_time(sec: &mut i64, nsec: &mut i32);
|
||||
pub unsafe fn get_time(sec: &mut i64, nsec: &mut i32);
|
||||
|
||||
unsafe fn precise_time_ns(ns: &mut u64);
|
||||
pub unsafe fn precise_time_ns(ns: &mut u64);
|
||||
|
||||
unsafe fn rust_tzset();
|
||||
pub unsafe fn rust_tzset();
|
||||
// FIXME: The i64 values can be passed by-val when #2064 is fixed.
|
||||
unsafe fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: Tm);
|
||||
unsafe fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: Tm);
|
||||
unsafe fn rust_timegm(&&tm: Tm, sec: &mut i64);
|
||||
unsafe fn rust_mktime(&&tm: Tm, sec: &mut i64);
|
||||
pub unsafe fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: Tm);
|
||||
pub unsafe fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: Tm);
|
||||
pub unsafe fn rust_timegm(&&tm: Tm, sec: &mut i64);
|
||||
pub unsafe fn rust_mktime(&&tm: Tm, sec: &mut i64);
|
||||
}
|
||||
|
||||
/// A record specifying a time value in seconds and nanoseconds.
|
||||
@ -890,8 +889,6 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
|
||||
use time::*;
|
||||
|
||||
use core::float;
|
||||
@ -902,7 +899,7 @@ mod tests {
|
||||
use core::uint;
|
||||
use core::vec;
|
||||
|
||||
fn test_get_time() {
|
||||
pub fn test_get_time() {
|
||||
const some_recent_date: i64 = 1325376000i64; // 2012-01-01T00:00:00Z
|
||||
const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
|
||||
|
||||
@ -925,7 +922,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn test_precise_time() {
|
||||
pub fn test_precise_time() {
|
||||
let s0 = precise_time_s();
|
||||
let ns1 = precise_time_ns();
|
||||
|
||||
@ -942,7 +939,7 @@ mod tests {
|
||||
assert ns2 >= ns1;
|
||||
}
|
||||
|
||||
fn test_at_utc() {
|
||||
pub fn test_at_utc() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -963,7 +960,7 @@ mod tests {
|
||||
assert utc.tm_nsec == 54321_i32;
|
||||
}
|
||||
|
||||
fn test_at() {
|
||||
pub fn test_at() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -991,7 +988,7 @@ mod tests {
|
||||
assert local.tm_nsec == 54321_i32;
|
||||
}
|
||||
|
||||
fn test_to_timespec() {
|
||||
pub fn test_to_timespec() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -1002,7 +999,7 @@ mod tests {
|
||||
assert utc.to_local().to_timespec() == time;
|
||||
}
|
||||
|
||||
fn test_conversions() {
|
||||
pub fn test_conversions() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -1018,7 +1015,7 @@ mod tests {
|
||||
assert utc.to_local().to_utc() == utc;
|
||||
}
|
||||
|
||||
fn test_strptime() {
|
||||
pub fn test_strptime() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -1172,7 +1169,7 @@ mod tests {
|
||||
assert test(~"%", ~"%%");
|
||||
}
|
||||
|
||||
fn test_ctime() {
|
||||
pub fn test_ctime() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -1186,7 +1183,7 @@ mod tests {
|
||||
assert local.ctime() == ~"Fri Feb 13 15:31:30 2009";
|
||||
}
|
||||
|
||||
fn test_strftime() {
|
||||
pub fn test_strftime() {
|
||||
os::setenv(~"TZ", ~"America/Los_Angeles");
|
||||
tzset();
|
||||
|
||||
@ -1259,7 +1256,7 @@ mod tests {
|
||||
assert utc.rfc3339() == ~"2009-02-13T23:31:30Z";
|
||||
}
|
||||
|
||||
fn test_timespec_eq_ord() {
|
||||
pub fn test_timespec_eq_ord() {
|
||||
use core::cmp::{eq, ge, gt, le, lt, ne};
|
||||
|
||||
let a = &Timespec::new(-2, 1);
|
||||
@ -1293,7 +1290,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_tests() {
|
||||
pub fn run_tests() {
|
||||
// The tests race on tzset. So instead of having many independent
|
||||
// tests, we will just call the functions now.
|
||||
test_get_time();
|
||||
|
@ -169,8 +169,6 @@ extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[legacy_exports];
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use timer::*;
|
||||
@ -182,13 +180,13 @@ mod test {
|
||||
use core::task;
|
||||
|
||||
#[test]
|
||||
fn test_gl_timer_simple_sleep_test() {
|
||||
pub fn test_gl_timer_simple_sleep_test() {
|
||||
let hl_loop = &uv::global_loop::get();
|
||||
sleep(hl_loop, 1u);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gl_timer_sleep_stress1() {
|
||||
pub fn test_gl_timer_sleep_stress1() {
|
||||
let hl_loop = &uv::global_loop::get();
|
||||
for iter::repeat(50u) {
|
||||
sleep(hl_loop, 1u);
|
||||
@ -196,7 +194,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gl_timer_sleep_stress2() {
|
||||
pub fn test_gl_timer_sleep_stress2() {
|
||||
let po = oldcomm::Port();
|
||||
let ch = oldcomm::Chan(&po);
|
||||
let hl_loop = &uv::global_loop::get();
|
||||
@ -238,7 +236,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
#[cfg(ignore)]
|
||||
fn test_gl_timer_recv_timeout_before_time_passes() {
|
||||
pub fn test_gl_timer_recv_timeout_before_time_passes() {
|
||||
let times = 100;
|
||||
let mut successes = 0;
|
||||
let mut failures = 0;
|
||||
@ -268,7 +266,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gl_timer_recv_timeout_after_time_passes() {
|
||||
pub fn test_gl_timer_recv_timeout_after_time_passes() {
|
||||
let times = 100;
|
||||
let mut successes = 0;
|
||||
let mut failures = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user