diff options
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/tests/macros.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index eb97288f1..ff4599b71 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -1,8 +1,10 @@ | |||
1 | use super::{infer, type_at, type_at_pos}; | ||
2 | use crate::test_db::TestDB; | ||
3 | use insta::assert_snapshot; | 1 | use insta::assert_snapshot; |
4 | use ra_db::fixture::WithFixture; | 2 | use ra_db::fixture::WithFixture; |
5 | 3 | ||
4 | use super::{infer, type_at, type_at_pos}; | ||
5 | |||
6 | use crate::test_db::TestDB; | ||
7 | |||
6 | #[test] | 8 | #[test] |
7 | fn cfg_impl_def() { | 9 | fn cfg_impl_def() { |
8 | let (db, pos) = TestDB::with_position( | 10 | let (db, pos) = TestDB::with_position( |
@@ -658,3 +660,28 @@ fn test() { | |||
658 | ); | 660 | ); |
659 | assert_eq!("S", type_at_pos(&db, pos)); | 661 | assert_eq!("S", type_at_pos(&db, pos)); |
660 | } | 662 | } |
663 | |||
664 | #[test] | ||
665 | fn macro_in_arm() { | ||
666 | assert_snapshot!( | ||
667 | infer(r#" | ||
668 | macro_rules! unit { | ||
669 | () => { () }; | ||
670 | } | ||
671 | |||
672 | fn main() { | ||
673 | let x = match () { | ||
674 | unit!() => 92u32, | ||
675 | }; | ||
676 | } | ||
677 | "#), | ||
678 | @r###" | ||
679 | [52; 111) '{ ... }; }': () | ||
680 | [62; 63) 'x': u32 | ||
681 | [66; 108) 'match ... }': u32 | ||
682 | [72; 74) '()': () | ||
683 | [85; 92) 'unit!()': () | ||
684 | [96; 101) '92u32': u32 | ||
685 | "### | ||
686 | ); | ||
687 | } | ||