Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/inline_macro.rs')
-rw-r--r--crates/ide-assists/src/handlers/inline_macro.rs47
1 files changed, 46 insertions, 1 deletions
diff --git a/crates/ide-assists/src/handlers/inline_macro.rs b/crates/ide-assists/src/handlers/inline_macro.rs
index 3fc552306a..5aa8e56f56 100644
--- a/crates/ide-assists/src/handlers/inline_macro.rs
+++ b/crates/ide-assists/src/handlers/inline_macro.rs
@@ -148,7 +148,7 @@ macro_rules! num {
#[test]
fn inline_macro_simple_not_applicable_broken_macro() {
// FIXME: This is a bug. The macro should not expand, but it's
- // the same behaviour as the "Expand Macro Recursively" commmand
+ // the same behaviour as the "Expand Macro Recursively" command
// so it's presumably OK for the time being.
check_assist(
inline_macro,
@@ -254,4 +254,49 @@ fn f() { if true{}; }
"#,
)
}
+
+ #[test]
+ fn whitespace_between_text_and_pound() {
+ check_assist(
+ inline_macro,
+ r#"
+macro_rules! foo {
+ () => {
+ cfg_if! {
+ if #[cfg(test)] {
+ 1;
+ } else {
+ 1;
+ }
+ }
+ }
+}
+fn main() {
+ $0foo!();
+}
+"#,
+ r#"
+macro_rules! foo {
+ () => {
+ cfg_if! {
+ if #[cfg(test)] {
+ 1;
+ } else {
+ 1;
+ }
+ }
+ }
+}
+fn main() {
+ cfg_if!{
+ if #[cfg(test)]{
+ 1;
+ }else {
+ 1;
+ }
+};
+}
+"#,
+ );
+ }
}