Skip to content

Commit bfc2e56

Browse files
committed
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.
1 parent f913d4f commit bfc2e56

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

crates/ide/src/doc_links/tests.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,29 @@ pub struct $0Foo;
664664
expect![["[`foo`]"]],
665665
);
666666
}
667+
668+
#[test]
669+
fn rewrite_intra_doc_link() {
670+
check_rewrite(
671+
r#"
672+
//- minicore: eq, derive
673+
//- /main.rs crate:foo
674+
//! $0[PartialEq]
675+
fn main() {}
676+
"#,
677+
expect!["[PartialEq](https://doc.rust-lang.org/stable/core/cmp/trait.PartialEq.html)"],
678+
);
679+
}
680+
681+
#[test]
682+
fn rewrite_intra_doc_link_with_anchor() {
683+
check_rewrite(
684+
r#"
685+
//- minicore: eq, derive
686+
//- /main.rs crate:foo
687+
//! $0[PartialEq#derivable]
688+
fn main() {}
689+
"#,
690+
expect!["[PartialEq#derivable](https://doc.rust-lang.org/stable/core/cmp/trait.PartialEq.html#derivable)"],
691+
);
692+
}

0 commit comments

Comments
 (0)