aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers
diff options
context:
space:
mode:
authorpetr-tik <[email protected]>2020-07-27 21:28:41 +0100
committerpetr-tik <[email protected]>2020-07-27 21:28:41 +0100
commit01bdeaad71ea87e2e989fc9ded06f69805929e42 (patch)
tree4eacdf54fd21aec64950e58c543e716d9d9b50df /crates/ra_assists/src/handlers
parent63751d1c6b8b2dbc2a7eb8df1f8c508693227cd6 (diff)
Make all test fn names consistent in remove_dbg
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r--crates/ra_assists/src/handlers/remove_dbg.rs32
1 files changed, 29 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/remove_dbg.rs b/crates/ra_assists/src/handlers/remove_dbg.rs
index e19620d5a..1116d2a2c 100644
--- a/crates/ra_assists/src/handlers/remove_dbg.rs
+++ b/crates/ra_assists/src/handlers/remove_dbg.rs
@@ -99,6 +99,7 @@ fn foo(n: usize) {
99", 99",
100 ); 100 );
101 } 101 }
102
102 #[test] 103 #[test]
103 fn test_remove_dbg_with_brackets_and_braces() { 104 fn test_remove_dbg_with_brackets_and_braces() {
104 check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1"); 105 check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1");
@@ -113,7 +114,7 @@ fn foo(n: usize) {
113 } 114 }
114 115
115 #[test] 116 #[test]
116 fn remove_dbg_target() { 117 fn test_remove_dbg_target() {
117 check_assist_target( 118 check_assist_target(
118 remove_dbg, 119 remove_dbg,
119 " 120 "
@@ -128,7 +129,7 @@ fn foo(n: usize) {
128 } 129 }
129 130
130 #[test] 131 #[test]
131 fn remove_dbg_leave_semicolon() { 132 fn test_remove_dbg_keep_semicolon() {
132 // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779 133 // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779
133 // not quite though 134 // not quite though
134 let code = " 135 let code = "
@@ -141,10 +142,35 @@ let res = 1 * 20; // needless comment
141 } 142 }
142 143
143 #[test] 144 #[test]
144 fn remove_dbg_keep_expression() { 145 fn test_remove_dbg_keep_expression() {
145 let code = " 146 let code = "
146let res = <|>dbg!(a + b).foo();"; 147let res = <|>dbg!(a + b).foo();";
147 let expected = "let res = (a + b).foo();"; 148 let expected = "let res = (a + b).foo();";
148 check_assist(remove_dbg, code, expected); 149 check_assist(remove_dbg, code, expected);
149 } 150 }
151
152 #[test]
153 fn test_remove_dbg_from_inside_fn() {
154 let code = "
155fn square(x: u32) -> u32 {
156 x * x
157}
158
159fn main() {
160 let x = square(dbg<|>!(5 + 10));
161 println!(\"{}\", x);
162}";
163
164 let expected = "
165fn square(x: u32) -> u32 {
166 x * x
167}
168
169fn main() {
170 let x = square(5 + 10);
171 println!(\"{}\", x);
172}";
173 check_assist_target(remove_dbg, code, "dbg!(5 + 10)");
174 check_assist(remove_dbg, code, expected);
175 }
150} 176}