2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2015-05-08 10:12:29 -05:00
|
|
|
// error-pattern:Ensure that the child thread runs by panicking
|
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() {
|
2014-10-09 14:17:22 -05:00
|
|
|
assert!("Ensure that the child task runs by panicking".is_empty());
|
2012-01-08 13:19:44 -06:00
|
|
|
}
|