aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorpetr-tik <[email protected]>2020-07-24 18:57:40 +0100
committerpetr-tik <[email protected]>2020-07-27 21:28:07 +0100
commit63751d1c6b8b2dbc2a7eb8df1f8c508693227cd6 (patch)
tree1a92146acbe2ea6771edf25c5662ff99773d592f /crates
parent6ddcdb8b29f495f09b9e2456001be252d401e394 (diff)
Added failing tests
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/remove_dbg.rs21
1 files changed, 21 insertions, 0 deletions
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) {
126 "dbg!(n.checked_sub(4))", 126 "dbg!(n.checked_sub(4))",
127 ); 127 );
128 } 128 }
129
130 #[test]
131 fn remove_dbg_leave_semicolon() {
132 // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779
133 // not quite though
134 let code = "
135let res = <|>dbg!(1 * 20); // needless comment
136";
137 let expected = "
138let res = 1 * 20; // needless comment
139";
140 check_assist(remove_dbg, code, expected);
141 }
142
143 #[test]
144 fn remove_dbg_keep_expression() {
145 let code = "
146let res = <|>dbg!(a + b).foo();";
147 let expected = "let res = (a + b).foo();";
148 check_assist(remove_dbg, code, expected);
149 }
129} 150}