mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
add test for doctests with custom target paths
This commit is contained in:
parent
4785b64642
commit
e5d9b034ec
@ -437,45 +437,6 @@ fn no_cross_doctests() {
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn cross_doctests() {
|
|
||||||
if cross_compile::disabled() || !cross_compile::can_run_on_host() || !is_nightly() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
//! ```
|
|
||||||
//! extern crate foo;
|
|
||||||
//! assert!(true);
|
|
||||||
//! ```
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let target = cross_compile::alternate();
|
|
||||||
|
|
||||||
// This tests the library and runs the doc tests.
|
|
||||||
p.cargo("test -v -Z doctest-xcompile --target")
|
|
||||||
.arg(&target)
|
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.with_stderr(&format!(
|
|
||||||
"\
|
|
||||||
[COMPILING] foo v0.0.1 ([CWD])
|
|
||||||
[RUNNING] `rustc --crate-name foo [..]
|
|
||||||
[RUNNING] `rustc --crate-name foo [..]--test[..]
|
|
||||||
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
|
|
||||||
[RUNNING] `[CWD]/target/{triple}/debug/deps/foo-[..][EXE]`
|
|
||||||
[DOCTEST] foo
|
|
||||||
[RUNNING] `rustdoc [..]
|
|
||||||
",
|
|
||||||
triple = target
|
|
||||||
))
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn simple_cargo_run() {
|
fn simple_cargo_run() {
|
||||||
if !cross_compile::can_run_on_host() {
|
if !cross_compile::can_run_on_host() {
|
||||||
|
@ -51,6 +51,12 @@ fn custom_target_minimal() {
|
|||||||
p.cargo("build --lib --target custom-target.json -v").run();
|
p.cargo("build --lib --target custom-target.json -v").run();
|
||||||
p.cargo("build --lib --target src/../custom-target.json -v")
|
p.cargo("build --lib --target src/../custom-target.json -v")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
// Ensure that the correct style of flag is passed to --target with doc tests.
|
||||||
|
p.cargo("test --doc --target src/../custom-target.json -v -Zdoctest-xcompile")
|
||||||
|
.masquerade_as_nightly_cargo()
|
||||||
|
.with_stderr_contains("[RUNNING] `rustdoc [..]--target [..]foo/custom-target.json[..]")
|
||||||
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user