Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanjain28 committed Jun 19, 2024
1 parent 9b61903 commit 33d4ab6
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/tools/rust-analyzer/crates/ide/src/expand_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,29 +230,26 @@ mod tests {
}

#[test]
fn only_expand_allowed_builtin_macro() {
let fail_tests = [r#"
//- minicore: asm
$0asm!("0x300, x0");
"#];

for test in fail_tests {
let (analysis, pos) = fixture::position(test);
let expansion = analysis.expand_macro(pos).unwrap();
assert!(expansion.is_none());
}

let tests = [(
fn expand_allowed_builtin_macro() {
check(
r#"
//- minicore: concat
$0concat!("test", 10, 'b', true);"#,
expect![[r#"
concat!
"test10btrue""#]],
)];
for (test, expect) in tests {
check(test, expect);
}
);
}

#[test]
fn do_not_expand_disallowed_macro() {
let (analysis, pos) = fixture::position(
r#"
//- minicore: asm
$0asm!("0x300, x0");"#,
);
let expansion = analysis.expand_macro(pos).unwrap();
assert!(expansion.is_none());
}

#[test]
Expand Down

0 comments on commit 33d4ab6

Please sign in to comment.