mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Make all test fn names consistent in remove_dbg
This commit is contained in:
parent
63751d1c6b
commit
01bdeaad71
1 changed files with 29 additions and 3 deletions
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue