Skip to content

Commit e23b073

Browse files
test: fix exclude_tests_macro_refs test to use custom macro
1 parent edacd0d commit e23b073

1 file changed

Lines changed: 10 additions & 39 deletions

File tree

crates/ide/src/references.rs

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -513,61 +513,32 @@ fn test() {
513513
}
514514

515515
#[test]
516-
fn test_access() {
516+
fn exclude_tests_macro_refs() {
517517
check(
518518
r#"
519-
struct S { f$0: u32 }
520-
521-
#[test]
522-
fn test() {
523-
let mut x = S { f: 92 };
524-
x.f = 92;
519+
macro_rules! my_macro {
520+
($e:expr) => { $e };
525521
}
526-
"#,
527-
expect![[r#"
528-
f Field FileId(0) 11..17 11..12
529522
530-
FileId(0) 61..62 read test
531-
FileId(0) 76..77 write test
532-
"#]],
533-
);
534-
}
535-
#[test]
536-
fn exclude_tests_macro_refs() {
537-
check(
538-
r#"
539523
fn foo$0() -> i32 { 42 }
540524
541525
fn bar() {
542526
foo();
543527
}
544528
545-
#[cfg(test)]
546-
mod tests {
547-
use super::*;
548-
549-
#[test]
550-
fn t1() {
551-
let f = foo();
552-
}
553-
554-
#[test]
555-
fn t2() {
556-
dbg!(foo());
557-
assert_eq!(foo(), 42);
558-
let v = vec![foo()];
559-
}
529+
#[test]
530+
fn t2() {
531+
my_macro!(foo());
560532
}
561533
"#,
562-
expect![[r#"
563-
foo Function FileId(0) 0..22 3..6
534+
expect![[r#"
535+
foo Function FileId(0) 52..74 55..58
564536
565-
FileId(0) 39..42
566-
FileId(0) 135..138
537+
FileId(0) 91..94
538+
FileId(0) 133..136 test
567539
"#]],
568540
);
569541
}
570-
571542
#[test]
572543
fn test_struct_literal_after_space() {
573544
check(

0 commit comments

Comments
 (0)