From 63751d1c6b8b2dbc2a7eb8df1f8c508693227cd6 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Fri, 24 Jul 2020 18:57:40 +0100 Subject: Added failing tests --- crates/ra_assists/src/handlers/remove_dbg.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (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 a616cca57..e19620d5a 100644 --- a/crates/ra_assists/src/handlers/remove_dbg.rs +++ b/crates/ra_assists/src/handlers/remove_dbg.rs @@ -126,4 +126,25 @@ fn foo(n: usize) { "dbg!(n.checked_sub(4))", ); } + + #[test] + fn remove_dbg_leave_semicolon() { + // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779 + // not quite though + let code = " +let res = <|>dbg!(1 * 20); // needless comment +"; + let expected = " +let res = 1 * 20; // needless comment +"; + check_assist(remove_dbg, code, expected); + } + + #[test] + fn 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); + } } -- cgit v1.2.3