Move doc_links tests from hover to doc_links
This commit is contained in:
parent
a35687fe1f
commit
bb71ebb985
@ -602,6 +602,78 @@ trait Trait$0 {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rewrite_html_root_url() {
|
||||
check_rewrite(
|
||||
r#"
|
||||
#![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
|
||||
|
||||
pub mod foo {
|
||||
pub struct Foo;
|
||||
}
|
||||
/// [Foo](foo::Foo)
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rewrite_on_field() {
|
||||
// FIXME: Should be
|
||||
// [Foo](https://docs.rs/test/*/test/struct.Foo.html)
|
||||
check_rewrite(
|
||||
r#"
|
||||
pub struct Foo {
|
||||
/// [Foo](struct.Foo.html)
|
||||
fie$0ld: ()
|
||||
}
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rewrite_struct() {
|
||||
check_rewrite(
|
||||
r#"
|
||||
/// [Foo]
|
||||
pub struct $0Foo;
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
check_rewrite(
|
||||
r#"
|
||||
/// [`Foo`]
|
||||
pub struct $0Foo;
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
check_rewrite(
|
||||
r#"
|
||||
/// [Foo](struct.Foo.html)
|
||||
pub struct $0Foo;
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
check_rewrite(
|
||||
r#"
|
||||
/// [struct Foo](struct.Foo.html)
|
||||
pub struct $0Foo;
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
check_rewrite(
|
||||
r#"
|
||||
/// [my Foo][foo]
|
||||
///
|
||||
/// [foo]: Foo
|
||||
pub struct $0Foo;
|
||||
"#,
|
||||
expect"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rewrite() {
|
||||
check_rewrite(
|
||||
|
@ -1779,335 +1779,6 @@ fn foo() { let bar = Ba$0r; }
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_path_link() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [Foo](struct.Foo.html)
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_path_link_no_strip() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [struct Foo](struct.Foo.html)
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_path_link_field() {
|
||||
// FIXME: Should be
|
||||
// [Foo](https://docs.rs/test/*/test/struct.Foo.html)
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
pub struct Bar {
|
||||
/// [Foo](struct.Foo.html)
|
||||
fie$0ld: ()
|
||||
}
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link() {
|
||||
check(
|
||||
r#"
|
||||
pub mod foo {
|
||||
pub struct Foo;
|
||||
}
|
||||
/// [Foo](foo::Foo)
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_html_root_url() {
|
||||
check(
|
||||
r#"
|
||||
#![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
|
||||
|
||||
pub mod foo {
|
||||
pub struct Foo;
|
||||
}
|
||||
/// [Foo](foo::Foo)
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_shortlink() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [Foo]
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_shortlink_code() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [`Foo`]
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_namespaced() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
fn Foo() {}
|
||||
/// [Foo()]
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_shortlink_namspaced_code() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [`struct Foo`]
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [`struct@Foo`]
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_reference() {
|
||||
check(
|
||||
r#"
|
||||
pub struct Foo;
|
||||
/// [my Foo][foo]
|
||||
///
|
||||
/// [foo]: Foo
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_intra_link_reference_to_trait_method() {
|
||||
check(
|
||||
r#"
|
||||
pub trait Foo {
|
||||
fn buzz() -> usize;
|
||||
}
|
||||
/// [Foo][buzz]
|
||||
///
|
||||
/// [buzz]: Foo::buzz
|
||||
pub struct B$0ar
|
||||
"#,
|
||||
expect
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_external_url() {
|
||||
check(
|
||||
@ -2161,60 +1832,6 @@ pub struct B$0ar
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_links_enum_variant() {
|
||||
check(
|
||||
r#"
|
||||
enum E {
|
||||
/// [E]
|
||||
V$0 { field: i32 }
|
||||
}
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_links_field() {
|
||||
check(
|
||||
r#"
|
||||
struct S {
|
||||
/// [`S`]
|
||||
field$0: i32
|
||||
}
|
||||
"#,
|
||||
expect
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_no_links() {
|
||||
check_hover_no_links(
|
||||
|
Loading…
x
Reference in New Issue
Block a user