aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/lib.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-04-06 05:12:32 +0100
committerEdwin Cheng <[email protected]>2019-04-06 05:12:32 +0100
commit1d7735fbc6795c3ea5f02950b47413e0b35d6677 (patch)
treef013ef48f7bdb5d1cf5dd7f63100e4ab665fb633 /crates/ra_mbe/src/lib.rs
parent0372eca5b2e6dade5132a08db46992ca73a25188 (diff)
Add path test and empty eat_path handling
Diffstat (limited to 'crates/ra_mbe/src/lib.rs')
-rw-r--r--crates/ra_mbe/src/lib.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
index 4203929d4..a5b7fab52 100644
--- a/crates/ra_mbe/src/lib.rs
+++ b/crates/ra_mbe/src/lib.rs
@@ -379,4 +379,26 @@ SOURCE_FILE@[0; 40)
379 // [let] [s] [=] ["rust1"] [;] 379 // [let] [s] [=] ["rust1"] [;]
380 assert_eq!(to_literal(&stm_tokens[15 + 3]).text, "\"rust1\""); 380 assert_eq!(to_literal(&stm_tokens[15 + 3]).text, "\"rust1\"");
381 } 381 }
382
383 /// The following tests are port from intellij-rust directly
384 /// https://github.com/intellij-rust/intellij-rust/blob/c4e9feee4ad46e7953b1948c112533360b6087bb/src/test/kotlin/org/rust/lang/core/macros/RsMacroExpansionTest.kt
385
386 #[test]
387 fn test_path() {
388 let rules = create_rules(
389 r#"
390 macro_rules! foo {
391 ($ i:path) => {
392 fn foo() { let a = $ i; }
393 }
394 }
395"#,
396 );
397 assert_expansion(&rules, "foo! { foo }", "fn foo () {let a = foo ;}");
398 assert_expansion(
399 &rules,
400 "foo! { bar::<u8>::baz::<u8> }",
401 "fn foo () {let a = bar :: < u8 > :: baz :: < u8 > ;}",
402 );
403 }
382} 404}