From af54b1e248f377853957ada0270e269bedb577b4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 23 May 2021 23:19:00 +0300 Subject: minimize tests --- crates/ide_assists/src/handlers/generate_getter.rs | 98 ++++++++++++---------- 1 file changed, 54 insertions(+), 44 deletions(-) (limited to 'crates') diff --git a/crates/ide_assists/src/handlers/generate_getter.rs b/crates/ide_assists/src/handlers/generate_getter.rs index fbd47d761..c77395824 100644 --- a/crates/ide_assists/src/handlers/generate_getter.rs +++ b/crates/ide_assists/src/handlers/generate_getter.rs @@ -135,39 +135,43 @@ mod tests { check_assist( generate_getter, r#" -struct Context { - dat$0a: T, -}"#, +struct Context { + dat$0a: Data, +} +"#, r#" -struct Context { - data: T, +struct Context { + data: Data, } -impl Context { +impl Context { /// Get a reference to the context's data. - fn data(&self) -> &T { + fn data(&self) -> &Data { &self.data } -}"#, +} +"#, ); check_assist( generate_getter_mut, r#" -struct Context { - dat$0a: T, -}"#, +struct Context { + dat$0a: Data, +} +"#, r#" -struct Context { - data: T, +struct Context { + data: Data, } -impl Context { +impl Context { /// Get a mutable reference to the context's data. - fn data_mut(&mut self) -> &mut T { + fn data_mut(&mut self) -> &mut Data { &mut self.data } -}"#, +} +"#, ); } @@ -176,29 +180,31 @@ impl Context { check_assist_not_applicable( generate_getter, r#" -struct Context { - dat$0a: T, +struct Context { + dat$0a: Data, } -impl Context { - fn data(&self) -> &T { +impl Context { + fn data(&self) -> &Data { &self.data } -}"#, +} +"#, ); check_assist_not_applicable( generate_getter_mut, r#" -struct Context { - dat$0a: T, +struct Context { + dat$0a: Data, } -impl Context { - fn data_mut(&mut self) -> &mut T { +impl Context { + fn data_mut(&mut self) -> &mut Data { &mut self.data } -}"#, +} +"#, ); } @@ -207,20 +213,22 @@ impl Context { check_assist( generate_getter, r#" -pub(crate) struct Context { - dat$0a: T, -}"#, +pub(crate) struct Context { + dat$0a: Data, +} +"#, r#" -pub(crate) struct Context { - data: T, +pub(crate) struct Context { + data: Data, } -impl Context { +impl Context { /// Get a reference to the context's data. - pub(crate) fn data(&self) -> &T { + pub(crate) fn data(&self) -> &Data { &self.data } -}"#, +} +"#, ); } @@ -229,26 +237,27 @@ impl Context { check_assist( generate_getter, r#" -struct Context { - data: T, +struct Context { + data: Data, cou$0nt: usize, } -impl Context { +impl Context { /// Get a reference to the context's data. - fn data(&self) -> &T { + fn data(&self) -> &Data { &self.data } -}"#, +} +"#, r#" -struct Context { - data: T, +struct Context { + data: Data, count: usize, } -impl Context { +impl Context { /// Get a reference to the context's data. - fn data(&self) -> &T { + fn data(&self) -> &Data { &self.data } @@ -256,7 +265,8 @@ impl Context { fn count(&self) -> &usize { &self.count } -}"#, +} +"#, ); } } -- cgit v1.2.3