forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#75979 - lzutao:seprate-tests, r=Mark-Simulacrum
Move `#[cfg(test)]` modules into separate files to save recompiling the `std` crate Implements an accepted proposal: rust-lang/compiler-team#344 Some notes for reviewers: * `mod tests` nested in `mod foo` in `mod bar`, I move `foo` to a new file, `tests` is a new file in foo: For example library/std/src/sys/sgx/abi/tls.rs * `mod test` (not `mod tests`) also is moved. * `mod benches` are moved. * `mod tests` is placed before any `use` statements: The topic is discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Code.20Style.20process * Some files in cloudabi was changed too. But I notice copyright banners in those files, should we ping cloudabi people? * I formatted files after moving tests around. I think that may make it easier to review :p . * Some files don't need `ignore-tidy-filelength` anymore.
- Loading branch information
Showing
122 changed files
with
16,583 additions
and
16,704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use super::*; | ||
|
||
#[test] | ||
fn test_debug() { | ||
let backtrace = Backtrace { | ||
inner: Inner::Captured(Mutex::new(Capture { | ||
actual_start: 1, | ||
resolved: true, | ||
frames: vec![ | ||
BacktraceFrame { | ||
frame: RawFrame::Fake, | ||
symbols: vec![BacktraceSymbol { | ||
name: Some(b"std::backtrace::Backtrace::create".to_vec()), | ||
filename: Some(BytesOrWide::Bytes(b"rust/backtrace.rs".to_vec())), | ||
lineno: Some(100), | ||
}], | ||
}, | ||
BacktraceFrame { | ||
frame: RawFrame::Fake, | ||
symbols: vec![BacktraceSymbol { | ||
name: Some(b"__rust_maybe_catch_panic".to_vec()), | ||
filename: None, | ||
lineno: None, | ||
}], | ||
}, | ||
BacktraceFrame { | ||
frame: RawFrame::Fake, | ||
symbols: vec![ | ||
BacktraceSymbol { | ||
name: Some(b"std::rt::lang_start_internal".to_vec()), | ||
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())), | ||
lineno: Some(300), | ||
}, | ||
BacktraceSymbol { | ||
name: Some(b"std::rt::lang_start".to_vec()), | ||
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())), | ||
lineno: Some(400), | ||
}, | ||
], | ||
}, | ||
], | ||
})), | ||
}; | ||
|
||
#[rustfmt::skip] | ||
let expected = "Backtrace [\ | ||
\n { fn: \"__rust_maybe_catch_panic\" },\ | ||
\n { fn: \"std::rt::lang_start_internal\", file: \"rust/rt.rs\", line: 300 },\ | ||
\n { fn: \"std::rt::lang_start\", file: \"rust/rt.rs\", line: 400 },\ | ||
\n]"; | ||
|
||
assert_eq!(format!("{:#?}", backtrace), expected); | ||
} |
Oops, something went wrong.