Skip to content

Commit 33a800c

Browse files
committed
test: show trim-paths=diagnostics doesnt works for rustdoc
It should be working with the next commit.
1 parent 0a752c6 commit 33a800c

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

tests/testsuite/profile_trim_paths.rs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,3 +752,88 @@ Hello, Ferris!
752752
"#]],
753753
);
754754
}
755+
756+
#[cargo_test(nightly, reason = "rustdoc --remap-path-prefix is unstable")]
757+
fn rustdoc_without_diagnostics_scope() {
758+
Package::new("bar", "0.0.1")
759+
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
760+
.file(
761+
"src/lib.rs",
762+
r#"
763+
/// </script>
764+
pub struct Bar;
765+
"#,
766+
)
767+
.publish();
768+
let p = project()
769+
.file(
770+
"Cargo.toml",
771+
r#"
772+
[package]
773+
name = "foo"
774+
version = "0.0.1"
775+
edition = "2015"
776+
777+
[dependencies]
778+
bar = "0.0.1"
779+
780+
[profile.dev]
781+
trim-paths = "object"
782+
"#,
783+
)
784+
.file("src/lib.rs", "")
785+
.build();
786+
787+
p.cargo("doc -vv -Ztrim-paths")
788+
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
789+
.with_stderr_data(str![[r#"
790+
...
791+
[WARNING] unopened HTML tag `script`
792+
--> [ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs:2:17
793+
...
794+
"#]])
795+
.run();
796+
}
797+
798+
#[cargo_test(nightly, reason = "rustdoc --remap-path-prefix is unstable")]
799+
fn rustdoc_diagnostics_works() {
800+
// This is expected to work after rust-lang/rust#128736
801+
Package::new("bar", "0.0.1")
802+
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
803+
.file(
804+
"src/lib.rs",
805+
r#"
806+
/// </script>
807+
pub struct Bar;
808+
"#,
809+
)
810+
.publish();
811+
let p = project()
812+
.file(
813+
"Cargo.toml",
814+
r#"
815+
[package]
816+
name = "foo"
817+
version = "0.0.1"
818+
edition = "2015"
819+
820+
[dependencies]
821+
bar = "0.0.1"
822+
823+
[profile.dev]
824+
trim-paths = "diagnostics"
825+
"#,
826+
)
827+
.file("src/lib.rs", "")
828+
.build();
829+
830+
p.cargo("doc -vv -Ztrim-paths")
831+
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
832+
.with_stderr_data(str![[r#"
833+
...
834+
[WARNING] unopened HTML tag `script`
835+
--> [ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs:2:17
836+
...
837+
"#]])
838+
.run();
839+
}

0 commit comments

Comments
 (0)