mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Update test calls to 'expect'
This commit is contained in:
parent
f05d7b41a7
commit
9522a06fd4
1 changed files with 36 additions and 22 deletions
|
@ -1477,33 +1477,35 @@ fn foo() { let bar = Ba<|>r; }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_path_link() {
|
fn test_hover_path_link() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [Foo](struct.Foo.html)
|
/// [Foo](struct.Foo.html)
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_path_link_no_strip() {
|
fn test_hover_path_link_no_strip() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [struct Foo](struct.Foo.html)
|
/// [struct Foo](struct.Foo.html)
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[struct Foo](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link() {
|
fn test_hover_intra_link() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub mod foo {
|
pub mod foo {
|
||||||
|
@ -1512,39 +1514,43 @@ fn foo() { let bar = Ba<|>r; }
|
||||||
/// [Foo](foo::Foo)
|
/// [Foo](foo::Foo)
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/foo/struct.Foo.html)"],
|
expect"]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link_shortlink() {
|
fn test_hover_intra_link_shortlink() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [Foo]
|
/// [Foo]
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link_shortlink_code() {
|
fn test_hover_intra_link_shortlink_code() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [`Foo`]
|
/// [`Foo`]
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link_namespaced() {
|
fn test_hover_intra_link_namespaced() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
|
@ -1552,39 +1558,45 @@ fn foo() { let bar = Ba<|>r; }
|
||||||
/// [Foo()]
|
/// [Foo()]
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link_shortlink_namspaced_code() {
|
fn test_hover_intra_link_shortlink_namspaced_code() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [`struct Foo`]
|
/// [`struct Foo`]
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
|
fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [`struct@Foo`]
|
/// [`struct@Foo`]
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_intra_link_reference() {
|
fn test_hover_intra_link_reference() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
|
@ -1593,34 +1605,36 @@ fn foo() { let bar = Ba<|>r; }
|
||||||
/// [foo]: Foo
|
/// [foo]: Foo
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[my Foo](https://docs.rs/test/*/test/struct.Foo.html)"],
|
expect"
|
||||||
|
]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_external_url() {
|
fn test_hover_external_url() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [external](https://www.google.com)
|
/// [external](https://www.google.com)
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[external](https://www.google.com)"],
|
expect"]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that we don't rewrite links which we can't identify
|
// Check that we don't rewrite links which we can't identify
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_unknown_target() {
|
fn test_hover_unknown_target() {
|
||||||
check_hover_result(
|
check(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
pub struct Foo;
|
pub struct Foo;
|
||||||
/// [baz](Baz)
|
/// [baz](Baz)
|
||||||
pub struct B<|>ar
|
pub struct B<|>ar
|
||||||
",
|
",
|
||||||
&["pub struct Bar\n```\n___\n\n[baz](Baz)"],
|
expect"]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue