Skip to content

Commit 0bf986d

Browse files
committed
add test case with marco reference
1 parent bd26403 commit 0bf986d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs

+39
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,45 @@ mod tests {
440440

441441
use super::*;
442442

443+
#[test]
444+
fn test_with_marco() {
445+
check_assist(
446+
extract_struct_from_enum_variant,
447+
r#"
448+
macro_rules! foo {
449+
($x:expr) => {
450+
$x
451+
};
452+
}
453+
454+
enum TheEnum {
455+
TheVariant$0 { the_field: u8 },
456+
}
457+
458+
fn main() {
459+
foo![TheEnum::TheVariant { the_field: 42 }];
460+
}
461+
"#,
462+
r#"
463+
macro_rules! foo {
464+
($x:expr) => {
465+
$x
466+
};
467+
}
468+
469+
struct TheVariant{ the_field: u8 }
470+
471+
enum TheEnum {
472+
TheVariant(TheVariant),
473+
}
474+
475+
fn main() {
476+
foo![TheEnum::TheVariant { the_field: 42 }];
477+
}
478+
"#,
479+
);
480+
}
481+
443482
#[test]
444483
fn issue_16197() {
445484
check_assist(

0 commit comments

Comments
 (0)