Add a test

This commit is contained in:
Steven Fackler 2015-03-18 09:03:17 -07:00
parent 2e8e8ab564
commit a51cd61164

View file

@ -402,3 +402,29 @@ pub fn _print(args: fmt::Arguments) {
panic!("failed printing to stdout: {}", e);
}
}
#[cfg(test)]
mod test {
use thread;
use super::*;
#[test]
fn panic_doesnt_poison() {
thread::spawn(|| {
let _a = stdin();
let _a = _a.lock();
let _a = stdout();
let _a = _a.lock();
let _a = stderr();
let _a = _a.lock();
panic!();
}).join().unwrap_err();
let _a = stdin();
let _a = _a.lock();
let _a = stdout();
let _a = _a.lock();
let _a = stderr();
let _a = _a.lock();
}
}