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