aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/traits/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src/traits/tests.rs')
-rw-r--r--crates/ide_db/src/traits/tests.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ide_db/src/traits/tests.rs b/crates/ide_db/src/traits/tests.rs
index 09c7ac3ec..84bb25505 100644
--- a/crates/ide_db/src/traits/tests.rs
+++ b/crates/ide_db/src/traits/tests.rs
@@ -5,12 +5,12 @@ use hir::Semantics;
5use syntax::ast::{self, AstNode}; 5use syntax::ast::{self, AstNode};
6use test_utils::RangeOrOffset; 6use test_utils::RangeOrOffset;
7 7
8/// Creates analysis from a multi-file fixture, returns positions marked with <|>. 8/// Creates analysis from a multi-file fixture, returns positions marked with $0.
9pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { 9pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
10 let change_fixture = ChangeFixture::parse(ra_fixture); 10 let change_fixture = ChangeFixture::parse(ra_fixture);
11 let mut database = RootDatabase::default(); 11 let mut database = RootDatabase::default();
12 database.apply_change(change_fixture.change); 12 database.apply_change(change_fixture.change);
13 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); 13 let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)");
14 let offset = match range_or_offset { 14 let offset = match range_or_offset {
15 RangeOrOffset::Range(_) => panic!(), 15 RangeOrOffset::Range(_) => panic!(),
16 RangeOrOffset::Offset(it) => it, 16 RangeOrOffset::Offset(it) => it,
@@ -55,7 +55,7 @@ pub trait Foo {
55 fn bar(); 55 fn bar();
56} 56}
57impl Foo for u8 { 57impl Foo for u8 {
58 <|> 58 $0
59} 59}
60 "#, 60 "#,
61 expect![["Foo"]], 61 expect![["Foo"]],
@@ -68,7 +68,7 @@ pub trait Foo {
68impl Foo for u8 { 68impl Foo for u8 {
69 fn bar() { 69 fn bar() {
70 fn baz() { 70 fn baz() {
71 <|> 71 $0
72 } 72 }
73 baz(); 73 baz();
74 } 74 }
@@ -83,7 +83,7 @@ pub trait Foo {
83} 83}
84pub struct Bar; 84pub struct Bar;
85impl Bar { 85impl Bar {
86 <|> 86 $0
87} 87}
88 "#, 88 "#,
89 expect![[""]], 89 expect![[""]],
@@ -99,7 +99,7 @@ pub trait Foo {
99 fn bar(); 99 fn bar();
100} 100}
101impl Foo for u8 { 101impl Foo for u8 {
102 <|> 102 $0
103}"#, 103}"#,
104 expect![[r#" 104 expect![[r#"
105 FOO 105 FOO
@@ -114,7 +114,7 @@ pub trait Foo {
114} 114}
115impl Foo for u8 { 115impl Foo for u8 {
116 const FOO: u8 = 10; 116 const FOO: u8 = 10;
117 <|> 117 $0
118}"#, 118}"#,
119 expect![[r#" 119 expect![[r#"
120 bar"#]], 120 bar"#]],
@@ -128,7 +128,7 @@ pub trait Foo {
128} 128}
129impl Foo for u8 { 129impl Foo for u8 {
130 const FOO: u8 = 10; 130 const FOO: u8 = 10;
131 fn bar() {<|>} 131 fn bar() {$0}
132}"#, 132}"#,
133 expect![[r#""#]], 133 expect![[r#""#]],
134 ); 134 );
@@ -137,7 +137,7 @@ impl Foo for u8 {
137 r#" 137 r#"
138pub struct Foo; 138pub struct Foo;
139impl Foo { 139impl Foo {
140 fn bar() {<|>} 140 fn bar() {$0}
141}"#, 141}"#,
142 expect![[r#""#]], 142 expect![[r#""#]],
143 ); 143 );