aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests/macros.rs')
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index ffa78b046..3b7022ad5 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -363,6 +363,26 @@ fn main() {
363} 363}
364 364
365#[test] 365#[test]
366fn infer_local_macro() {
367 assert_snapshot!(
368 infer(r#"
369fn main() {
370 macro_rules! foo {
371 () => { 1usize }
372 }
373 let _a = foo!();
374}
375"#),
376 @r###"
377 ![0; 6) '1usize': usize
378 [11; 90) '{ ...!(); }': ()
379 [17; 66) 'macro_... }': {unknown}
380 [75; 77) '_a': usize
381 "###
382 );
383}
384
385#[test]
366fn infer_builtin_macros_line() { 386fn infer_builtin_macros_line() {
367 assert_snapshot!( 387 assert_snapshot!(
368 infer(r#" 388 infer(r#"
@@ -550,6 +570,26 @@ fn main() {
550} 570}
551 571
552#[test] 572#[test]
573fn infer_builtin_macros_env() {
574 assert_snapshot!(
575 infer(r#"
576//- /main.rs env:foo=bar
577#[rustc_builtin_macro]
578macro_rules! env {() => {}}
579
580fn main() {
581 let x = env!("foo");
582}
583"#),
584 @r###"
585 ![0; 5) '"bar"': &str
586 [88; 116) '{ ...o"); }': ()
587 [98; 99) 'x': &str
588 "###
589 );
590}
591
592#[test]
553fn infer_derive_clone_simple() { 593fn infer_derive_clone_simple() {
554 let (db, pos) = TestDB::with_position( 594 let (db, pos) = TestDB::with_position(
555 r#" 595 r#"