2018-08-28 09:20:03 +00:00
|
|
|
use support::{basic_manifest, project};
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2016-05-25 20:55:42 +00:00
|
|
|
#[test]
|
|
|
|
fn rustdoc_simple() {
|
2018-08-28 09:20:03 +00:00
|
|
|
let p = project().file("src/lib.rs", "").build();
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("rustdoc -v")
|
|
|
|
.with_stderr(format!(
|
2018-03-14 15:17:44 +00:00
|
|
|
"\
|
2018-08-29 17:56:48 +00:00
|
|
|
[DOCUMENTING] foo v0.0.1 (CWD)
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
|
2018-08-29 17:56:48 +00:00
|
|
|
-o CWD/target/doc \
|
|
|
|
-L dependency=CWD/target/debug/deps`
|
2017-01-12 01:03:36 +00:00
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
2018-03-14 15:17:44 +00:00
|
|
|
",
|
2018-08-28 09:20:03 +00:00
|
|
|
)).run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2016-05-25 20:55:42 +00:00
|
|
|
#[test]
|
|
|
|
fn rustdoc_args() {
|
2018-08-28 09:20:03 +00:00
|
|
|
let p = project().file("src/lib.rs", "").build();
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("rustdoc -v -- --cfg=foo")
|
|
|
|
.with_stderr(format!(
|
2018-03-14 15:17:44 +00:00
|
|
|
"\
|
2018-08-29 17:56:48 +00:00
|
|
|
[DOCUMENTING] foo v0.0.1 (CWD)
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
|
2018-08-29 17:56:48 +00:00
|
|
|
-o CWD/target/doc \
|
2017-08-30 14:50:40 +00:00
|
|
|
--cfg=foo \
|
2018-08-29 17:56:48 +00:00
|
|
|
-L dependency=CWD/target/debug/deps`
|
2017-01-12 01:03:36 +00:00
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
2018-03-14 15:17:44 +00:00
|
|
|
",
|
2018-08-28 09:20:03 +00:00
|
|
|
)).run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2016-05-25 20:55:42 +00:00
|
|
|
#[test]
|
|
|
|
fn rustdoc_foo_with_bar_dependency() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let foo = project()
|
2018-03-14 15:17:44 +00:00
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
2015-09-09 08:46:43 +00:00
|
|
|
[package]
|
|
|
|
name = "foo"
|
|
|
|
version = "0.0.1"
|
|
|
|
authors = []
|
|
|
|
|
|
|
|
[dependencies.bar]
|
|
|
|
path = "../bar"
|
2018-03-14 15:17:44 +00:00
|
|
|
"#,
|
2018-08-28 09:20:03 +00:00
|
|
|
).file("src/lib.rs", "extern crate bar; pub fn foo() {}")
|
2017-07-22 03:12:21 +00:00
|
|
|
.build();
|
2018-08-28 09:20:03 +00:00
|
|
|
let _bar = project()
|
|
|
|
.at("bar")
|
2018-07-24 22:35:01 +00:00
|
|
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
2018-07-25 00:30:32 +00:00
|
|
|
.file("src/lib.rs", "pub fn baz() {}")
|
2017-07-22 03:12:21 +00:00
|
|
|
.build();
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
foo.cargo("rustdoc -v -- --cfg=foo")
|
|
|
|
.with_stderr(format!(
|
2018-03-14 15:17:44 +00:00
|
|
|
"\
|
2018-04-19 18:19:11 +00:00
|
|
|
[CHECKING] bar v0.0.1 ([..])
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustc [..]bar/src/lib.rs [..]`
|
2018-08-29 17:56:48 +00:00
|
|
|
[DOCUMENTING] foo v0.0.1 (CWD)
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
|
2018-08-29 17:56:48 +00:00
|
|
|
-o CWD/target/doc \
|
2017-08-30 14:50:40 +00:00
|
|
|
--cfg=foo \
|
2018-08-29 17:56:48 +00:00
|
|
|
-L dependency=CWD/target/debug/deps \
|
2015-09-09 08:46:43 +00:00
|
|
|
--extern [..]`
|
2017-01-12 01:03:36 +00:00
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
2018-03-14 15:17:44 +00:00
|
|
|
",
|
2018-08-28 09:20:03 +00:00
|
|
|
)).run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2016-05-25 20:55:42 +00:00
|
|
|
#[test]
|
|
|
|
fn rustdoc_only_bar_dependency() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let foo = project()
|
2018-03-14 15:17:44 +00:00
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
2015-09-09 08:46:43 +00:00
|
|
|
[package]
|
|
|
|
name = "foo"
|
|
|
|
version = "0.0.1"
|
|
|
|
authors = []
|
|
|
|
|
|
|
|
[dependencies.bar]
|
|
|
|
path = "../bar"
|
2018-03-14 15:17:44 +00:00
|
|
|
"#,
|
2018-08-28 09:20:03 +00:00
|
|
|
).file("src/main.rs", "extern crate bar; fn main() { bar::baz() }")
|
2017-07-22 03:12:21 +00:00
|
|
|
.build();
|
2018-08-28 09:20:03 +00:00
|
|
|
let _bar = project()
|
|
|
|
.at("bar")
|
2018-07-24 22:35:01 +00:00
|
|
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
2018-07-25 00:30:32 +00:00
|
|
|
.file("src/lib.rs", "pub fn baz() {}")
|
2017-07-22 03:12:21 +00:00
|
|
|
.build();
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
foo.cargo("rustdoc -v -p bar -- --cfg=foo")
|
|
|
|
.with_stderr(format!(
|
2018-03-14 15:17:44 +00:00
|
|
|
"\
|
2016-05-11 16:55:43 +00:00
|
|
|
[DOCUMENTING] bar v0.0.1 ([..])
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustdoc --crate-name bar [..]bar/src/lib.rs \
|
2018-08-29 17:56:48 +00:00
|
|
|
-o CWD/target/doc \
|
2017-08-30 14:50:40 +00:00
|
|
|
--cfg=foo \
|
2018-08-29 17:56:48 +00:00
|
|
|
-L dependency=CWD/target/debug/deps`
|
2017-01-12 01:03:36 +00:00
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
2018-03-14 15:17:44 +00:00
|
|
|
",
|
2018-08-28 09:20:03 +00:00
|
|
|
)).run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2016-05-25 20:55:42 +00:00
|
|
|
#[test]
|
2017-10-16 16:30:57 +00:00
|
|
|
fn rustdoc_same_name_documents_lib() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project()
|
2018-07-25 00:30:32 +00:00
|
|
|
.file("src/main.rs", "fn main() {}")
|
2017-07-22 03:12:21 +00:00
|
|
|
.file("src/lib.rs", r#" "#)
|
|
|
|
.build();
|
2015-09-09 08:46:43 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("rustdoc -v -- --cfg=foo")
|
|
|
|
.with_stderr(format!(
|
2018-03-14 15:17:44 +00:00
|
|
|
"\
|
2017-10-16 16:30:57 +00:00
|
|
|
[DOCUMENTING] foo v0.0.1 ([..])
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
|
2018-08-29 17:56:48 +00:00
|
|
|
-o CWD/target/doc \
|
2017-10-16 16:30:57 +00:00
|
|
|
--cfg=foo \
|
2018-08-29 17:56:48 +00:00
|
|
|
-L dependency=CWD/target/debug/deps`
|
2017-10-16 16:30:57 +00:00
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
2018-03-14 15:17:44 +00:00
|
|
|
",
|
2018-08-28 09:20:03 +00:00
|
|
|
)).run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2018-03-27 22:56:46 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn features() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project()
|
2018-03-27 22:56:46 +00:00
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
|
|
|
[package]
|
|
|
|
name = "foo"
|
|
|
|
version = "0.0.1"
|
|
|
|
authors = []
|
|
|
|
|
|
|
|
[features]
|
|
|
|
quux = []
|
|
|
|
"#,
|
2018-08-28 09:20:03 +00:00
|
|
|
).file("src/lib.rs", "")
|
2018-03-27 22:56:46 +00:00
|
|
|
.build();
|
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("rustdoc --verbose --features quux")
|
|
|
|
.with_stderr_contains("[..]feature=[..]quux[..]")
|
|
|
|
.run();
|
2018-03-27 22:56:46 +00:00
|
|
|
}
|
2018-05-28 14:27:52 +00:00
|
|
|
|
|
|
|
#[test]
|
2018-08-28 09:20:03 +00:00
|
|
|
#[cfg(all(
|
|
|
|
target_arch = "x86_64",
|
|
|
|
target_os = "linux",
|
|
|
|
target_env = "gnu"
|
|
|
|
))]
|
2018-05-28 14:27:52 +00:00
|
|
|
fn rustdoc_target() {
|
2018-08-28 09:20:03 +00:00
|
|
|
let p = project().file("src/lib.rs", "").build();
|
2018-05-28 14:27:52 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("rustdoc --verbose --target x86_64-unknown-linux-gnu")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
2018-07-24 13:01:56 +00:00
|
|
|
[DOCUMENTING] foo v0.0.1 ([..])
|
2018-08-02 09:18:48 +00:00
|
|
|
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
|
2018-05-28 14:27:52 +00:00
|
|
|
--target x86_64-unknown-linux-gnu \
|
2018-08-29 17:56:48 +00:00
|
|
|
-o CWD/target/x86_64-unknown-linux-gnu/doc \
|
|
|
|
-L dependency=CWD/target/x86_64-unknown-linux-gnu/debug/deps \
|
|
|
|
-L dependency=CWD/target/debug/deps`
|
2018-08-28 09:20:03 +00:00
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
|
|
|
|
).run();
|
2018-05-28 14:27:52 +00:00
|
|
|
}
|