2020-04-16 01:50:32 -05:00
|
|
|
// run-fail
|
2015-05-08 10:12:29 -05:00
|
|
|
// error-pattern:Ensure that the child thread runs by panicking
|
2016-09-05 19:00:09 -05:00
|
|
|
// ignore-emscripten Needs threads.
|
2012-01-08 13:19:44 -06:00
|
|
|
|
2015-02-17 17:10:25 -06:00
|
|
|
use std::thread;
|
2013-05-24 21:35:29 -05:00
|
|
|
|
2012-01-08 13:19:44 -06:00
|
|
|
fn main() {
|
2015-05-08 10:12:29 -05:00
|
|
|
// the purpose of this test is to make sure that thread::spawn()
|
2012-01-08 13:19:44 -06:00
|
|
|
// works when provided with a bare function:
|
2015-02-17 17:10:25 -06:00
|
|
|
let r = thread::spawn(startfn).join();
|
2014-06-25 20:18:13 -05:00
|
|
|
if r.is_err() {
|
2014-10-09 14:17:22 -05:00
|
|
|
panic!()
|
2014-06-25 20:18:13 -05:00
|
|
|
}
|
2012-01-08 13:19:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn startfn() {
|
2015-05-08 12:14:51 -05:00
|
|
|
assert!("Ensure that the child thread runs by panicking".is_empty());
|
2012-01-08 13:19:44 -06:00
|
|
|
}
|