From 759bcea96de448a7758276a9ce5696a56b44b465 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 11 Mar 2020 23:08:12 +0800 Subject: Implement dummy assert macro --- crates/ra_ide/src/hover.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 25e038a55..89640efb6 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -838,14 +838,10 @@ fn func(foo: i32) { if true { <|>foo; }; } r#" //- /lib.rs #[rustc_builtin_macro] - macro_rules! assert { - ($cond:expr) => {{ /* compiler built-in */ }}; - ($cond:expr,) => {{ /* compiler built-in */ }}; - ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }}; - } + macro_rules! format {} fn foo() { - assert!("hel<|>lo"); + format!("hel<|>lo {}", 0); } "#, ); -- cgit v1.2.3 From 8c159b54e9617de4248f947db8cbe0272b640915 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 11 Mar 2020 23:14:15 +0800 Subject: Add test on hover --- crates/ra_ide/src/hover.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 89640efb6..0bbba4855 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -832,6 +832,25 @@ fn func(foo: i32) { if true { <|>foo; }; } assert_eq!(hover_on, "\"Tracks\""); } + #[test] + fn test_hover_through_assert_macro() { + let hover_on = check_hover_result( + r#" + //- /lib.rs + #[rustc_builtin_macro] + macro_rules! assert {} + + fn bar() -> bool { true } + fn foo() { + assert!(ba<|>r()); + } + "#, + &["fn bar() -> bool"], + ); + + assert_eq!(hover_on, "bar"); + } + #[test] fn test_hover_through_literal_string_in_builtin_macro() { check_hover_no_result( -- cgit v1.2.3