From 9522a06fd444c670202fd64c91d1ba62e332ff70 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Fri, 31 Jul 2020 14:28:33 +1200 Subject: Update test calls to 'expect' --- crates/ra_ide/src/hover.rs | 58 ++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 22 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index ad68bc43c..02099b05d 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -1477,33 +1477,35 @@ fn foo() { let bar = Ba<|>r; } #[test] fn test_hover_path_link() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [Foo](struct.Foo.html) pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_path_link_no_strip() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [struct Foo](struct.Foo.html) pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[struct Foo](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![["pub struct Bar\n```\n___\n\n[struct Foo](https://docs.rs/test/*/test/struct.Foo.html)"]], ); } #[test] fn test_hover_intra_link() { - check_hover_result( + check( r" //- /lib.rs pub mod foo { @@ -1512,39 +1514,43 @@ fn foo() { let bar = Ba<|>r; } /// [Foo](foo::Foo) pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/foo/struct.Foo.html)"], + expect![["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/foo/struct.Foo.html)"]], ); } #[test] fn test_hover_intra_link_shortlink() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [Foo] pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_intra_link_shortlink_code() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [`Foo`] pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_intra_link_namespaced() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; @@ -1552,39 +1558,45 @@ fn foo() { let bar = Ba<|>r; } /// [Foo()] pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[Foo](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_intra_link_shortlink_namspaced_code() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [`struct Foo`] pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_intra_link_shortlink_namspaced_code_with_at() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [`struct@Foo`] pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[`Foo`](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_intra_link_reference() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; @@ -1593,34 +1605,36 @@ fn foo() { let bar = Ba<|>r; } /// [foo]: Foo pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[my Foo](https://docs.rs/test/*/test/struct.Foo.html)"], + expect![[ + "pub struct Bar\n```\n___\n\n[my Foo](https://docs.rs/test/*/test/struct.Foo.html)" + ]], ); } #[test] fn test_hover_external_url() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [external](https://www.google.com) pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[external](https://www.google.com)"], + expect![["pub struct Bar\n```\n___\n\n[external](https://www.google.com)"]], ); } // Check that we don't rewrite links which we can't identify #[test] fn test_hover_unknown_target() { - check_hover_result( + check( r" //- /lib.rs pub struct Foo; /// [baz](Baz) pub struct B<|>ar ", - &["pub struct Bar\n```\n___\n\n[baz](Baz)"], + expect![["pub struct Bar\n```\n___\n\n[baz](Baz)"]], ); } -- cgit v1.2.3