diff options
| author | bors <bors@rust-lang.org> | 2015-04-01 22:41:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-01 22:41:08 +0000 |
| commit | 2e3b0c051dca9880bf66b5366dccd2e0bb424b99 (patch) | |
| tree | 2e8b8ea5a0daf51f819acaab9b9e2572459e2a60 /src/libtest | |
| parent | d528aa9960cb9b937d8ef6c09905a6a8076d5f3a (diff) | |
| parent | 0304e15e5c39654346e827c2bb25ca41ed310c86 (diff) | |
| download | rust-2e3b0c051dca9880bf66b5366dccd2e0bb424b99.tar.gz rust-2e3b0c051dca9880bf66b5366dccd2e0bb424b99.zip | |
Auto merge of #23955 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/libtest')
| -rw-r--r-- | src/libtest/lib.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index f7e5c9f1dee..00117775eee 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -62,6 +62,7 @@ use self::OutputLocation::*; use stats::Stats; use getopts::{OptGroup, optflag, optopt}; use serialize::Encodable; +use std::boxed::FnBox; use term::Terminal; use term::color::{Color, RED, YELLOW, GREEN, CYAN}; @@ -79,7 +80,7 @@ use std::path::PathBuf; use std::sync::mpsc::{channel, Sender}; use std::sync::{Arc, Mutex}; use std::thread; -use std::thunk::{Thunk, Invoke}; +use std::thunk::Thunk; use std::time::Duration; // to be used by rustc to compile tests in libtest @@ -158,7 +159,7 @@ pub enum TestFn { StaticBenchFn(fn(&mut Bencher)), StaticMetricFn(fn(&mut MetricMap)), DynTestFn(Thunk<'static>), - DynMetricFn(Box<for<'a> Invoke<&'a mut MetricMap>+'static>), + DynMetricFn(Box<FnBox(&mut MetricMap)+Send>), DynBenchFn(Box<TDynBenchFn+'static>) } @@ -936,7 +937,7 @@ pub fn run_test(opts: &TestOpts, io::set_print(box Sink(data2.clone())); io::set_panic(box Sink(data2)); } - testfn.invoke(()) + testfn() }).unwrap(); let test_result = calc_result(&desc, result_guard.join()); let stdout = data.lock().unwrap().to_vec(); @@ -957,7 +958,7 @@ pub fn run_test(opts: &TestOpts, } DynMetricFn(f) => { let mut mm = MetricMap::new(); - f.invoke(&mut mm); + f.call_box((&mut mm,)); monitor_ch.send((desc, TrMetrics(mm), Vec::new())).unwrap(); return; } @@ -969,7 +970,7 @@ pub fn run_test(opts: &TestOpts, } DynTestFn(f) => run_test_inner(desc, monitor_ch, opts.nocapture, f), StaticTestFn(f) => run_test_inner(desc, monitor_ch, opts.nocapture, - Thunk::new(move|| f())) + Box::new(move|| f())) } } @@ -1185,7 +1186,7 @@ mod tests { ignore: true, should_panic: ShouldPanic::No, }, - testfn: DynTestFn(Thunk::new(move|| f())), + testfn: DynTestFn(Box::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1202,7 +1203,7 @@ mod tests { ignore: true, should_panic: ShouldPanic::No, }, - testfn: DynTestFn(Thunk::new(move|| f())), + testfn: DynTestFn(Box::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1219,7 +1220,7 @@ mod tests { ignore: false, should_panic: ShouldPanic::Yes(None) }, - testfn: DynTestFn(Thunk::new(move|| f())), + testfn: DynTestFn(Box::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1236,7 +1237,7 @@ mod tests { ignore: false, should_panic: ShouldPanic::Yes(Some("error message")) }, - testfn: DynTestFn(Thunk::new(move|| f())), + testfn: DynTestFn(Box::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1253,7 +1254,7 @@ mod tests { ignore: false, should_panic: ShouldPanic::Yes(Some("foobar")) }, - testfn: DynTestFn(Thunk::new(move|| f())), + testfn: DynTestFn(Box::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1270,7 +1271,7 @@ mod tests { ignore: false, should_panic: ShouldPanic::Yes(None) }, - testfn: DynTestFn(Thunk::new(move|| f())), + testfn: DynTestFn(Box::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1306,7 +1307,7 @@ mod tests { ignore: true, should_panic: ShouldPanic::No, }, - testfn: DynTestFn(Thunk::new(move|| {})), + testfn: DynTestFn(Box::new(move|| {})), }, TestDescAndFn { desc: TestDesc { @@ -1314,7 +1315,7 @@ mod tests { ignore: false, should_panic: ShouldPanic::No, }, - testfn: DynTestFn(Thunk::new(move|| {})), + testfn: DynTestFn(Box::new(move|| {})), }); let filtered = filter_tests(&opts, tests); @@ -1350,7 +1351,7 @@ mod tests { ignore: false, should_panic: ShouldPanic::No, }, - testfn: DynTestFn(Thunk::new(testfn)), + testfn: DynTestFn(Box::new(testfn)), }; tests.push(test); } |
