Make all test fn names consistent in remove_dbg

This commit is contained in:
petr-tik 2020-07-27 21:28:41 +01:00
parent 63751d1c6b
commit 01bdeaad71

View file

@ -99,6 +99,7 @@ fn foo(n: usize) {
", ",
); );
} }
#[test] #[test]
fn test_remove_dbg_with_brackets_and_braces() { fn test_remove_dbg_with_brackets_and_braces() {
check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1"); check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1");
@ -113,7 +114,7 @@ fn foo(n: usize) {
} }
#[test] #[test]
fn remove_dbg_target() { fn test_remove_dbg_target() {
check_assist_target( check_assist_target(
remove_dbg, remove_dbg,
" "
@ -128,7 +129,7 @@ fn foo(n: usize) {
} }
#[test] #[test]
fn remove_dbg_leave_semicolon() { fn test_remove_dbg_keep_semicolon() {
// https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779 // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779
// not quite though // not quite though
let code = " let code = "
@ -141,10 +142,35 @@ let res = 1 * 20; // needless comment
} }
#[test] #[test]
fn remove_dbg_keep_expression() { fn test_remove_dbg_keep_expression() {
let code = " let code = "
let res = <|>dbg!(a + b).foo();"; let res = <|>dbg!(a + b).foo();";
let expected = "let res = (a + b).foo();"; let expected = "let res = (a + b).foo();";
check_assist(remove_dbg, code, expected); check_assist(remove_dbg, code, expected);
} }
#[test]
fn test_remove_dbg_from_inside_fn() {
let code = "
fn square(x: u32) -> u32 {
x * x
}
fn main() {
let x = square(dbg<|>!(5 + 10));
println!(\"{}\", x);
}";
let expected = "
fn square(x: u32) -> u32 {
x * x
}
fn main() {
let x = square(5 + 10);
println!(\"{}\", x);
}";
check_assist_target(remove_dbg, code, "dbg!(5 + 10)");
check_assist(remove_dbg, code, expected);
}
} }