fix: making tests compatible with new trimmed sel_range

This commit is contained in:
vi_mi 2021-10-22 08:55:47 +00:00
parent 2bf5f14666
commit 3e73a46660
2 changed files with 26 additions and 52 deletions

View file

@ -28,11 +28,9 @@ use super::remove_unused_param::range_to_remove;
// resolved. // resolved.
// //
// ``` // ```
// $0 // $0fn foo(name: i32) -> i32 {
// fn foo(name: i32) -> i32 {
// name + 1 // name + 1
// } // }$0
// $0
// //
// fn bar(name: i32) -> i32 { // fn bar(name: i32) -> i32 {
// name + 2 // name + 2
@ -939,8 +937,7 @@ $0pub struct PublicStruct {
let _a = bar(); let _a = bar();
} }
$0 $0struct PrivateStruct {
struct PrivateStruct {
inner: SomeType, inner: SomeType,
} }
@ -956,8 +953,7 @@ impl PrivateStruct {
fn bar() -> i32 { fn bar() -> i32 {
2 2
} }$0
$0
} }
", ",
r" r"
@ -1019,11 +1015,9 @@ mod modname {
check_assist( check_assist(
extract_module, extract_module,
r" r"
$0 $0fn foo(name: i32) -> i32 {
fn foo(name: i32) -> i32 {
name + 1 name + 1
} }$0
$0
fn bar(name: i32) -> i32 { fn bar(name: i32) -> i32 {
name + 2 name + 2
@ -1049,15 +1043,13 @@ mod modname {
extract_module, extract_module,
r" r"
mod impl_play { mod impl_play {
$0 $0struct A {}
struct A {}
impl A { impl A {
pub fn new_a() -> i32 { pub fn new_a() -> i32 {
2 2
} }
} }$0
$0
fn a() { fn a() {
let _a = A::new_a(); let _a = A::new_a();
@ -1097,11 +1089,9 @@ mod modname {
mod bar { mod bar {
use super::foo::{PrivateStruct, PrivateStruct1}; use super::foo::{PrivateStruct, PrivateStruct1};
$0 $0struct Strukt {
struct Strukt {
field: PrivateStruct, field: PrivateStruct,
} }$0
$0
struct Strukt1 { struct Strukt1 {
field: PrivateStruct1, field: PrivateStruct1,
@ -1145,11 +1135,9 @@ mod modname {
mod bar { mod bar {
use super::foo::PrivateStruct; use super::foo::PrivateStruct;
$0 $0struct Strukt {
struct Strukt {
field: PrivateStruct, field: PrivateStruct,
} }$0
$0
struct Strukt1 { struct Strukt1 {
field: PrivateStruct, field: PrivateStruct,
@ -1188,11 +1176,9 @@ mod modname {
mod bar { mod bar {
pub struct PrivateStruct; pub struct PrivateStruct;
$0 $0struct Strukt {
struct Strukt {
field: PrivateStruct, field: PrivateStruct,
} }$0
$0
struct Strukt1 { struct Strukt1 {
field: PrivateStruct, field: PrivateStruct,
@ -1227,13 +1213,11 @@ mod modname {
mod impl_play { mod impl_play {
struct A {} struct A {}
$0 $0impl A {
impl A {
pub fn new_a() -> i32 { pub fn new_a() -> i32 {
2 2
} }
} }$0
$0
fn a() { fn a() {
let _a = A::new_a(); let _a = A::new_a();
@ -1274,13 +1258,11 @@ mod modname {
mod impl_play { mod impl_play {
use super::foo::A; use super::foo::A;
$0 $0impl A {
impl A {
pub fn new_a() -> i32 { pub fn new_a() -> i32 {
2 2
} }
} }$0
$0
fn a() { fn a() {
let _a = A::new_a(); let _a = A::new_a();
@ -1320,8 +1302,7 @@ mod modname {
mod impl_play2 { mod impl_play2 {
trait JustATrait {} trait JustATrait {}
$0 $0struct A {}
struct A {}
fn foo<T: JustATrait>(arg: T) -> T { fn foo<T: JustATrait>(arg: T) -> T {
arg arg
@ -1332,8 +1313,7 @@ impl JustATrait for A {}
fn bar() { fn bar() {
let a = A {}; let a = A {};
foo(a); foo(a);
} }$0
$0
} }
", ",
r" r"
@ -1367,11 +1347,9 @@ mod modname {
extract_module, extract_module,
r" r"
mod impl_play2 { mod impl_play2 {
$0 $0mod impl_play {
mod impl_play {
pub struct A {} pub struct A {}
} }$0
$0
} }
", ",
r" r"
@ -1401,11 +1379,9 @@ mod modname {
} }
fn main() { fn main() {
$0 $0struct Strukt1 {
struct Strukt1 {
field: Strukt, field: Strukt,
} }$0
$0
} }
//- /foo.rs //- /foo.rs
pub struct PrivateStruct; pub struct PrivateStruct;

View file

@ -531,11 +531,9 @@ fn doctest_extract_module() {
check_doc_test( check_doc_test(
"extract_module", "extract_module",
r#####" r#####"
$0 $0fn foo(name: i32) -> i32 {
fn foo(name: i32) -> i32 {
name + 1 name + 1
} }$0
$0
fn bar(name: i32) -> i32 { fn bar(name: i32) -> i32 {
name + 2 name + 2