diff options
| author | Steven Fackler <sfackler@gmail.com> | 2015-03-18 09:03:17 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2015-03-18 09:03:17 -0700 |
| commit | a51cd6116446d74a336abcb00f5ced3582ec307f (patch) | |
| tree | fabe87bed01a6cf16b0c0b34b102a8b4cc33afc4 /src/libstd | |
| parent | 2e8e8ab564891c3d2ffeeb0f8e1a4e850866f74f (diff) | |
| download | rust-a51cd6116446d74a336abcb00f5ced3582ec307f.tar.gz rust-a51cd6116446d74a336abcb00f5ced3582ec307f.zip | |
Add a test
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/stdio.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 615607eed1b..9b36408aa51 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -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(); + } +} |
