aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index 5d0efa0f4..42814941f 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -439,6 +439,51 @@ fn main() {
439} 439}
440 440
441#[test] 441#[test]
442fn infer_builtin_macros_include() {
443 let (db, pos) = TestDB::with_position(
444 r#"
445//- /main.rs
446#[rustc_builtin_macro]
447macro_rules! include {() => {}}
448
449include!("foo.rs");
450
451fn main() {
452 bar()<|>;
453}
454
455//- /foo.rs
456fn bar() -> u32 {0}
457"#,
458 );
459 assert_eq!("u32", type_at_pos(&db, pos));
460}
461
462#[test]
463fn infer_builtin_macros_include_concat() {
464 let (db, pos) = TestDB::with_position(
465 r#"
466//- /main.rs
467#[rustc_builtin_macro]
468macro_rules! include {() => {}}
469
470#[rustc_builtin_macro]
471macro_rules! concat {() => {}}
472
473include!(concat!("f", "oo.rs"));
474
475fn main() {
476 bar()<|>;
477}
478
479//- /foo.rs
480fn bar() -> u32 {0}
481"#,
482 );
483 assert_eq!("u32", type_at_pos(&db, pos));
484}
485
486#[test]
442fn infer_builtin_macros_concat_with_lazy() { 487fn infer_builtin_macros_concat_with_lazy() {
443 assert_snapshot!( 488 assert_snapshot!(
444 infer(r#" 489 infer(r#"