Skip to content

Commit 01bdeaa

Browse files
committed
Make all test fn names consistent in remove_dbg
1 parent 63751d1 commit 01bdeaa

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

crates/ra_assists/src/handlers/remove_dbg.rs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ fn foo(n: usize) {
9999
",
100100
);
101101
}
102+
102103
#[test]
103104
fn test_remove_dbg_with_brackets_and_braces() {
104105
check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1");
@@ -113,7 +114,7 @@ fn foo(n: usize) {
113114
}
114115

115116
#[test]
116-
fn remove_dbg_target() {
117+
fn test_remove_dbg_target() {
117118
check_assist_target(
118119
remove_dbg,
119120
"
@@ -128,7 +129,7 @@ fn foo(n: usize) {
128129
}
129130

130131
#[test]
131-
fn remove_dbg_leave_semicolon() {
132+
fn test_remove_dbg_keep_semicolon() {
132133
// https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779
133134
// not quite though
134135
let code = "
@@ -141,10 +142,35 @@ let res = 1 * 20; // needless comment
141142
}
142143

143144
#[test]
144-
fn remove_dbg_keep_expression() {
145+
fn test_remove_dbg_keep_expression() {
145146
let code = "
146147
let res = <|>dbg!(a + b).foo();";
147148
let expected = "let res = (a + b).foo();";
148149
check_assist(remove_dbg, code, expected);
149150
}
151+
152+
#[test]
153+
fn test_remove_dbg_from_inside_fn() {
154+
let code = "
155+
fn square(x: u32) -> u32 {
156+
x * x
157+
}
158+
159+
fn main() {
160+
let x = square(dbg<|>!(5 + 10));
161+
println!(\"{}\", x);
162+
}";
163+
164+
let expected = "
165+
fn square(x: u32) -> u32 {
166+
x * x
167+
}
168+
169+
fn 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+
}
150176
}

0 commit comments

Comments
 (0)