diff options
Diffstat (limited to 'crates/mbe/src/tests')
-rw-r--r-- | crates/mbe/src/tests/expand.rs | 33 | ||||
-rw-r--r-- | crates/mbe/src/tests/rule.rs | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs index 84f19d3e2..3a1d840ea 100644 --- a/crates/mbe/src/tests/expand.rs +++ b/crates/mbe/src/tests/expand.rs | |||
@@ -663,6 +663,21 @@ macro foo { | |||
663 | } | 663 | } |
664 | 664 | ||
665 | #[test] | 665 | #[test] |
666 | fn test_macro_2_0_panic_2015() { | ||
667 | parse_macro2( | ||
668 | r#" | ||
669 | macro panic_2015 { | ||
670 | () => ( | ||
671 | ), | ||
672 | (bar) => ( | ||
673 | ), | ||
674 | } | ||
675 | "#, | ||
676 | ) | ||
677 | .assert_expand_items("panic_2015!(bar);", ""); | ||
678 | } | ||
679 | |||
680 | #[test] | ||
666 | fn test_path() { | 681 | fn test_path() { |
667 | parse_macro( | 682 | parse_macro( |
668 | r#" | 683 | r#" |
@@ -926,6 +941,24 @@ fn test_meta_doc_comments() { | |||
926 | } | 941 | } |
927 | 942 | ||
928 | #[test] | 943 | #[test] |
944 | fn test_meta_extended_key_value_attributes() { | ||
945 | parse_macro( | ||
946 | r#" | ||
947 | macro_rules! foo { | ||
948 | (#[$i:meta]) => ( | ||
949 | #[$ i] | ||
950 | fn bar() {} | ||
951 | ) | ||
952 | } | ||
953 | "#, | ||
954 | ) | ||
955 | .assert_expand_items( | ||
956 | r#"foo! { #[doc = concat!("The `", "bla", "` lang item.")] }"#, | ||
957 | r#"# [doc = concat ! ("The `" , "bla" , "` lang item.")] fn bar () {}"#, | ||
958 | ); | ||
959 | } | ||
960 | |||
961 | #[test] | ||
929 | fn test_meta_doc_comments_non_latin() { | 962 | fn test_meta_doc_comments_non_latin() { |
930 | parse_macro( | 963 | parse_macro( |
931 | r#" | 964 | r#" |
diff --git a/crates/mbe/src/tests/rule.rs b/crates/mbe/src/tests/rule.rs index bf48112b3..5c61a98fd 100644 --- a/crates/mbe/src/tests/rule.rs +++ b/crates/mbe/src/tests/rule.rs | |||
@@ -44,6 +44,6 @@ fn parse_macro_arm(arm_definition: &str) -> Result<crate::MacroRules, ParseError | |||
44 | let macro_definition = | 44 | let macro_definition = |
45 | source_file.syntax().descendants().find_map(ast::MacroRules::cast).unwrap(); | 45 | source_file.syntax().descendants().find_map(ast::MacroRules::cast).unwrap(); |
46 | 46 | ||
47 | let (definition_tt, _) = ast_to_token_tree(¯o_definition.token_tree().unwrap()).unwrap(); | 47 | let (definition_tt, _) = ast_to_token_tree(¯o_definition.token_tree().unwrap()); |
48 | crate::MacroRules::parse(&definition_tt) | 48 | crate::MacroRules::parse(&definition_tt) |
49 | } | 49 | } |