Add tests for intra-doc links

The first one succeeds because the functionality is already implemented.
The second one fails and represents the functionality to be implemented
in this PR.
This commit is contained in:
Johann Hemmann 2024-01-09 14:52:40 +01:00
parent f913d4f4b7
commit bfc2e568dd

View file

@ -664,3 +664,29 @@ pub struct $0Foo;
expect![["[`foo`]"]],
);
}
#[test]
fn rewrite_intra_doc_link() {
check_rewrite(
r#"
//- minicore: eq, derive
//- /main.rs crate:foo
//! $0[PartialEq]
fn main() {}
"#,
expect!["[PartialEq](https://doc.rust-lang.org/stable/core/cmp/trait.PartialEq.html)"],
);
}
#[test]
fn rewrite_intra_doc_link_with_anchor() {
check_rewrite(
r#"
//- minicore: eq, derive
//- /main.rs crate:foo
//! $0[PartialEq#derivable]
fn main() {}
"#,
expect!["[PartialEq#derivable](https://doc.rust-lang.org/stable/core/cmp/trait.PartialEq.html#derivable)"],
);
}