aboutsummaryrefslogtreecommitdiff
path: root/crates/ssr
diff options
context:
space:
mode:
authorKevaundray Wedderburn <[email protected]>2021-01-06 20:15:48 +0000
committerKevaundray Wedderburn <[email protected]>2021-01-07 12:09:23 +0000
commit72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (patch)
treec138363e3592c690d841aeedb9ac97d6b2ff4396 /crates/ssr
parent171c3c08fe245938fb25321394233de5fe2abc7c (diff)
Change <|> to $0 - Rebase
Diffstat (limited to 'crates/ssr')
-rw-r--r--crates/ssr/src/tests.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ssr/src/tests.rs b/crates/ssr/src/tests.rs
index db9cb8ca1..d6918c22d 100644
--- a/crates/ssr/src/tests.rs
+++ b/crates/ssr/src/tests.rs
@@ -59,7 +59,7 @@ fn parser_undefined_placeholder_in_replacement() {
59 ); 59 );
60} 60}
61 61
62/// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be 62/// `code` may optionally contain a cursor marker `$0`. If it doesn't, then the position will be
63/// the start of the file. If there's a second cursor marker, then we'll return a single range. 63/// the start of the file. If there's a second cursor marker, then we'll return a single range.
64pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { 64pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) {
65 use ide_db::base_db::fixture::WithFixture; 65 use ide_db::base_db::fixture::WithFixture;
@@ -596,7 +596,7 @@ fn replace_function_call() {
596 // This test also makes sure that we ignore empty-ranges. 596 // This test also makes sure that we ignore empty-ranges.
597 assert_ssr_transform( 597 assert_ssr_transform(
598 "foo() ==>> bar()", 598 "foo() ==>> bar()",
599 "fn foo() {<|><|>} fn bar() {} fn f1() {foo(); foo();}", 599 "fn foo() {$0$0} fn bar() {} fn f1() {foo(); foo();}",
600 expect![["fn foo() {} fn bar() {} fn f1() {bar(); bar();}"]], 600 expect![["fn foo() {} fn bar() {} fn f1() {bar(); bar();}"]],
601 ); 601 );
602} 602}
@@ -706,7 +706,7 @@ fn replace_associated_trait_constant() {
706 706
707#[test] 707#[test]
708fn replace_path_in_different_contexts() { 708fn replace_path_in_different_contexts() {
709 // Note the <|> inside module a::b which marks the point where the rule is interpreted. We 709 // Note the $0 inside module a::b which marks the point where the rule is interpreted. We
710 // replace foo with bar, but both need different path qualifiers in different contexts. In f4, 710 // replace foo with bar, but both need different path qualifiers in different contexts. In f4,
711 // foo is unqualified because of a use statement, however the replacement needs to be fully 711 // foo is unqualified because of a use statement, however the replacement needs to be fully
712 // qualified. 712 // qualified.
@@ -714,7 +714,7 @@ fn replace_path_in_different_contexts() {
714 "c::foo() ==>> c::bar()", 714 "c::foo() ==>> c::bar()",
715 r#" 715 r#"
716 mod a { 716 mod a {
717 pub mod b {<|> 717 pub mod b {$0
718 pub mod c { 718 pub mod c {
719 pub fn foo() {} 719 pub fn foo() {}
720 pub fn bar() {} 720 pub fn bar() {}
@@ -1096,7 +1096,7 @@ fn pattern_is_a_single_segment_path() {
1096 fn f1() -> i32 { 1096 fn f1() -> i32 {
1097 let foo = 1; 1097 let foo = 1;
1098 let bar = 2; 1098 let bar = 2;
1099 foo<|> 1099 foo$0
1100 } 1100 }
1101 "#, 1101 "#,
1102 expect![[r#" 1102 expect![[r#"
@@ -1128,7 +1128,7 @@ fn replace_local_variable_reference() {
1128 let foo = 5; 1128 let foo = 5;
1129 res += foo + 1; 1129 res += foo + 1;
1130 let foo = 10; 1130 let foo = 10;
1131 res += foo + 2;<|> 1131 res += foo + 2;$0
1132 res += foo + 3; 1132 res += foo + 3;
1133 let foo = 15; 1133 let foo = 15;
1134 res += foo + 4; 1134 res += foo + 4;
@@ -1160,9 +1160,9 @@ fn replace_path_within_selection() {
1160 let foo = 41; 1160 let foo = 41;
1161 let bar = 42; 1161 let bar = 42;
1162 do_stuff(foo); 1162 do_stuff(foo);
1163 do_stuff(foo);<|> 1163 do_stuff(foo);$0
1164 do_stuff(foo); 1164 do_stuff(foo);
1165 do_stuff(foo);<|> 1165 do_stuff(foo);$0
1166 do_stuff(foo); 1166 do_stuff(foo);
1167 }"#, 1167 }"#,
1168 expect![[r#" 1168 expect![[r#"
@@ -1185,9 +1185,9 @@ fn replace_nonpath_within_selection() {
1185 "$a + $b ==>> $b * $a", 1185 "$a + $b ==>> $b * $a",
1186 r#" 1186 r#"
1187 fn main() { 1187 fn main() {
1188 let v = 1 + 2;<|> 1188 let v = 1 + 2;$0
1189 let v2 = 3 + 3; 1189 let v2 = 3 + 3;
1190 let v3 = 4 + 5;<|> 1190 let v3 = 4 + 5;$0
1191 let v4 = 6 + 7; 1191 let v4 = 6 + 7;
1192 }"#, 1192 }"#,
1193 expect![[r#" 1193 expect![[r#"
@@ -1212,7 +1212,7 @@ fn replace_self() {
1212 fn bar(_: &S1) {} 1212 fn bar(_: &S1) {}
1213 impl S1 { 1213 impl S1 {
1214 fn f1(&self) { 1214 fn f1(&self) {
1215 foo(self)<|> 1215 foo(self)$0
1216 } 1216 }
1217 fn f2(&self) { 1217 fn f2(&self) {
1218 foo(self) 1218 foo(self)