std: move "mod tests/benches" to separate files

Also doing fmt inplace as requested.
This commit is contained in:
Lzu Tao
2020-08-27 13:45:01 +00:00
parent db6cbfc49c
commit a4e926daee
120 changed files with 16569 additions and 16699 deletions

View File

@@ -1,5 +1,8 @@
#![cfg_attr(test, allow(unused))]
#[cfg(test)]
mod tests;
use crate::io::prelude::*;
use crate::cell::RefCell;
@@ -920,54 +923,3 @@ pub fn _eprint(args: fmt::Arguments<'_>) {
#[cfg(test)]
pub use realstd::io::{_eprint, _print};
#[cfg(test)]
mod tests {
use super::*;
use crate::panic::{RefUnwindSafe, UnwindSafe};
use crate::thread;
#[test]
fn stdout_unwind_safe() {
assert_unwind_safe::<Stdout>();
}
#[test]
fn stdoutlock_unwind_safe() {
assert_unwind_safe::<StdoutLock<'_>>();
assert_unwind_safe::<StdoutLock<'static>>();
}
#[test]
fn stderr_unwind_safe() {
assert_unwind_safe::<Stderr>();
}
#[test]
fn stderrlock_unwind_safe() {
assert_unwind_safe::<StderrLock<'_>>();
assert_unwind_safe::<StderrLock<'static>>();
}
fn assert_unwind_safe<T: UnwindSafe + RefUnwindSafe>() {}
#[test]
#[cfg_attr(target_os = "emscripten", ignore)]
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();
}
}