提交 a51cd611 编写于 作者: S Steven Fackler

Add a test

上级 2e8e8ab5
......@@ -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();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册