Follow testing style guide

This commit is contained in:
Jonas Schievink 2021-04-20 16:26:07 +02:00
parent 6624158969
commit c0ad9b3581

View file

@ -212,7 +212,7 @@ mod tests {
fn add_custom_impl_debug() { fn add_custom_impl_debug() {
check_assist( check_assist(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
mod fmt { mod fmt {
pub struct Error; pub struct Error;
pub type Result = Result<(), Error>; pub type Result = Result<(), Error>;
@ -226,8 +226,8 @@ mod fmt {
struct Foo { struct Foo {
bar: String, bar: String,
} }
", "#,
" r#"
mod fmt { mod fmt {
pub struct Error; pub struct Error;
pub type Result = Result<(), Error>; pub type Result = Result<(), Error>;
@ -246,14 +246,14 @@ impl fmt::Debug for Foo {
${0:todo!()} ${0:todo!()}
} }
} }
", "#,
) )
} }
#[test] #[test]
fn add_custom_impl_all() { fn add_custom_impl_all() {
check_assist( check_assist(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
mod foo { mod foo {
pub trait Bar { pub trait Bar {
type Qux; type Qux;
@ -268,8 +268,8 @@ mod foo {
struct Foo { struct Foo {
bar: String, bar: String,
} }
", "#,
" r#"
mod foo { mod foo {
pub trait Bar { pub trait Bar {
type Qux; type Qux;
@ -295,20 +295,20 @@ impl foo::Bar for Foo {
todo!() todo!()
} }
} }
", "#,
) )
} }
#[test] #[test]
fn add_custom_impl_for_unique_input() { fn add_custom_impl_for_unique_input() {
check_assist( check_assist(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[derive(Debu$0g)] #[derive(Debu$0g)]
struct Foo { struct Foo {
bar: String, bar: String,
} }
", "#,
" r#"
struct Foo { struct Foo {
bar: String, bar: String,
} }
@ -316,7 +316,7 @@ struct Foo {
impl Debug for Foo { impl Debug for Foo {
$0 $0
} }
", "#,
) )
} }
@ -324,13 +324,13 @@ impl Debug for Foo {
fn add_custom_impl_for_with_visibility_modifier() { fn add_custom_impl_for_with_visibility_modifier() {
check_assist( check_assist(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[derive(Debug$0)] #[derive(Debug$0)]
pub struct Foo { pub struct Foo {
bar: String, bar: String,
} }
", "#,
" r#"
pub struct Foo { pub struct Foo {
bar: String, bar: String,
} }
@ -338,7 +338,7 @@ pub struct Foo {
impl Debug for Foo { impl Debug for Foo {
$0 $0
} }
", "#,
) )
} }
@ -346,18 +346,18 @@ impl Debug for Foo {
fn add_custom_impl_when_multiple_inputs() { fn add_custom_impl_when_multiple_inputs() {
check_assist( check_assist(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[derive(Display, Debug$0, Serialize)] #[derive(Display, Debug$0, Serialize)]
struct Foo {} struct Foo {}
", "#,
" r#"
#[derive(Display, Serialize)] #[derive(Display, Serialize)]
struct Foo {} struct Foo {}
impl Debug for Foo { impl Debug for Foo {
$0 $0
} }
", "#,
) )
} }
@ -365,10 +365,10 @@ impl Debug for Foo {
fn test_ignore_derive_macro_without_input() { fn test_ignore_derive_macro_without_input() {
check_assist_not_applicable( check_assist_not_applicable(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[derive($0)] #[derive($0)]
struct Foo {} struct Foo {}
", "#,
) )
} }
@ -376,18 +376,18 @@ struct Foo {}
fn test_ignore_if_cursor_on_param() { fn test_ignore_if_cursor_on_param() {
check_assist_not_applicable( check_assist_not_applicable(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[derive$0(Debug)] #[derive$0(Debug)]
struct Foo {} struct Foo {}
", "#,
); );
check_assist_not_applicable( check_assist_not_applicable(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[derive(Debug)$0] #[derive(Debug)$0]
struct Foo {} struct Foo {}
", "#,
) )
} }
@ -395,10 +395,10 @@ struct Foo {}
fn test_ignore_if_not_derive() { fn test_ignore_if_not_derive() {
check_assist_not_applicable( check_assist_not_applicable(
replace_derive_with_manual_impl, replace_derive_with_manual_impl,
" r#"
#[allow(non_camel_$0case_types)] #[allow(non_camel_$0case_types)]
struct Foo {} struct Foo {}
", "#,
) )
} }