Skip to content

Commit 0b39bb9

Browse files
Add test for rustdoc --nocapture
1 parent caadd7d commit 0b39bb9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/testsuite/test.rs

+39
Original file line numberDiff line numberDiff line change
@@ -4388,3 +4388,42 @@ fn test_workspaces_cwd() {
43884388
.with_stdout_contains("test test_integration_deep_cwd ... ok")
43894389
.run();
43904390
}
4391+
4392+
#[cargo_test]
4393+
fn doctest_nocapture() {
4394+
let p = project()
4395+
.file(
4396+
"Cargo.toml",
4397+
r#"
4398+
[package]
4399+
name = "foo"
4400+
version = "0.0.1"
4401+
authors = []
4402+
[features]
4403+
bar = []
4404+
"#,
4405+
)
4406+
.file(
4407+
"src/lib.rs",
4408+
r#"
4409+
/// ```rust
4410+
/// println!("hello cake!");
4411+
/// ```
4412+
pub fn hello() {}
4413+
"#,
4414+
)
4415+
.build();
4416+
4417+
p.cargo("test -- --nocapture")
4418+
.with_stderr(
4419+
"\
4420+
[COMPILING] foo [..]
4421+
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
4422+
[RUNNING] [..] (target/debug/deps/foo[..][EXE])
4423+
[DOCTEST] foo",
4424+
)
4425+
.with_stdout_contains("running 0 tests")
4426+
.with_stdout_contains("test [..] ... ok")
4427+
.with_stdout_contains("hello cake!")
4428+
.run();
4429+
}

0 commit comments

Comments
 (0)