Skip to content

Commit

Permalink
Test the passing of --error-format to rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Feb 14, 2021
1 parent 5644bf7 commit 83b353b
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/testsuite/message_format.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Tests for --message-format flag.

use cargo_test_support::{basic_manifest, project};
use cargo_test_support::{basic_lib_manifest, basic_manifest, is_nightly, project};

#[cargo_test]
fn cannot_specify_two() {
Expand Down Expand Up @@ -109,3 +109,30 @@ fn cargo_renders_ansi() {
.with_stdout_contains("[..]\\u001b[38;5;9merror[..]")
.run();
}

#[cargo_test]
fn cargo_renders_doctests() {
if !is_nightly() {
// --error-format=short support added in 1.51
return;
}

let p = project()
.file("Cargo.toml", &basic_lib_manifest("foo"))
.file(
"src/lib.rs",
"\
/// ```rust
/// bar()
/// ```
pub fn bar() {}
",
)
.build();

p.cargo("test --doc --message-format short")
.with_status(101)
.with_stdout_contains("src/lib.rs:2:1: error[E0425]:[..]")
.with_stdout_contains("[..]src/lib.rs - bar (line 1)[..]")
.run();
}

0 comments on commit 83b353b

Please sign in to comment.