test for issue 3164
Closes 3164 Show that when `error_on_line_overflow=true` is set in the rustfmt.toml that an error message is written to stderr.
This commit is contained in:
parent
4c78c738ba
commit
c19b14539b
@ -98,3 +98,22 @@ fn cargo_fmt_out_of_line_test_modules() {
|
||||
assert!(stdout.contains(&format!("Diff in {}", path.display())))
|
||||
}
|
||||
}
|
||||
|
||||
#[rustfmt_only_ci_test]
|
||||
#[test]
|
||||
fn cargo_fmt_emits_error_on_line_overflow_true() {
|
||||
// See also https://github.com/rust-lang/rustfmt/issues/3164
|
||||
let args = [
|
||||
"--check",
|
||||
"--manifest-path",
|
||||
"tests/cargo-fmt/source/issue_3164/Cargo.toml",
|
||||
"--",
|
||||
"--config",
|
||||
"error_on_line_overflow=true",
|
||||
];
|
||||
|
||||
let (_stdout, stderr) = cargo_fmt(&args);
|
||||
assert!(stderr.contains(
|
||||
"line formatted, but exceeded maximum width (maximum: 100 (see `max_width` option)"
|
||||
))
|
||||
}
|
||||
|
8
tests/cargo-fmt/source/issue_3164/Cargo.toml
Normal file
8
tests/cargo-fmt/source/issue_3164/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "issue_3164"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
13
tests/cargo-fmt/source/issue_3164/src/main.rs
Normal file
13
tests/cargo-fmt/source/issue_3164/src/main.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! foo {
|
||||
($id:ident) => {
|
||||
macro_rules! bar {
|
||||
($id2:tt) => {
|
||||
#[cfg(any(target_feature = $id2, target_feature = $id2, target_feature = $id2, target_feature = $id2, target_feature = $id2))]
|
||||
fn $id() {}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -159,3 +159,18 @@ fn mod_resolution_error_path_attribute_does_not_exist() {
|
||||
// The path attribute points to a file that does not exist
|
||||
assert!(stderr.contains("does_not_exist.rs does not exist"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rustfmt_emits_error_on_line_overflow_true() {
|
||||
// See also https://github.com/rust-lang/rustfmt/issues/3164
|
||||
let args = [
|
||||
"--config",
|
||||
"error_on_line_overflow=true",
|
||||
"tests/cargo-fmt/source/issue_3164/src/main.rs",
|
||||
];
|
||||
|
||||
let (_stdout, stderr) = rustfmt(&args);
|
||||
assert!(stderr.contains(
|
||||
"line formatted, but exceeded maximum width (maximum: 100 (see `max_width` option)"
|
||||
))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user