Add test asserting we catch Rust parser panics
This commit is contained in:
parent
66c98db50f
commit
10b9afa906
1 changed files with 12 additions and 0 deletions
|
|
@ -288,6 +288,18 @@ fn stdin_formatting_smoke_test() {
|
|||
assert_eq!(buf, "fn main() {}\r\n".as_bytes());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stdin_parser_panic_caught() {
|
||||
// https://github.com/rust-lang/rustfmt/issues/3239
|
||||
for text in ["{", "}"].iter().cloned().map(String::from) {
|
||||
let mut buf = vec![];
|
||||
let mut session = Session::new(Default::default(), Some(&mut buf));
|
||||
let _ = session.format(Input::Text(text));
|
||||
|
||||
assert!(session.has_parsing_errors());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stdin_disable_all_formatting_test() {
|
||||
match option_env!("CFG_RELEASE_CHANNEL") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue