Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit ab6a545

Browse files
committed
Add multiple suggestions test
1 parent bd1b800 commit ab6a545

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

cargo-fix/tests/all/smoke.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,31 @@ fn preserve_line_endings() {
100100
p.expect_cmd("cargo fix").run();
101101
assert!(p.read("src/lib.rs").contains("\r\n"));
102102
}
103+
104+
#[test]
105+
fn multiple_suggestions_for_the_same_thing() {
106+
let p = project()
107+
.file("src/lib.rs", "\
108+
fn main() {
109+
let xs = vec![String::from(\"foo\")];
110+
// error: no diplay in scope, and there are two options
111+
// (std::path::Display and std::fmt::Display)
112+
let d: &Display = &xs;
113+
println!(\"{}\", d);
114+
}
115+
")
116+
.build();
117+
118+
let stderr = "\
119+
[CHECKING] foo v0.1.0 (CWD)
120+
error: Cannot replace slice of data that was already replaced
121+
error: Could not compile `foo`.
122+
123+
To learn more, run the command again with --verbose.
124+
";
125+
126+
p.expect_cmd("cargo fix")
127+
.stderr(stderr)
128+
.status(101)
129+
.run();
130+
}

0 commit comments

Comments
 (0)