From 01bdeaad71ea87e2e989fc9ded06f69805929e42 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Mon, 27 Jul 2020 21:28:41 +0100 Subject: Make all test fn names consistent in remove_dbg --- crates/ra_assists/src/handlers/remove_dbg.rs | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'crates/ra_assists') 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) { ", ); } + #[test] fn test_remove_dbg_with_brackets_and_braces() { check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1"); @@ -113,7 +114,7 @@ fn foo(n: usize) { } #[test] - fn remove_dbg_target() { + fn test_remove_dbg_target() { check_assist_target( remove_dbg, " @@ -128,7 +129,7 @@ fn foo(n: usize) { } #[test] - fn remove_dbg_leave_semicolon() { + fn test_remove_dbg_keep_semicolon() { // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779 // not quite though let code = " @@ -141,10 +142,35 @@ let res = 1 * 20; // needless comment } #[test] - fn remove_dbg_keep_expression() { + fn test_remove_dbg_keep_expression() { let code = " let res = <|>dbg!(a + b).foo();"; let expected = "let res = (a + b).foo();"; 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); + } } -- cgit v1.2.3