aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/tests.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-04-18 20:24:17 +0100
committerEdwin Cheng <[email protected]>2020-04-18 20:24:17 +0100
commita1b5cf81ebcac15299cc612b49023bb418507027 (patch)
treef1e34af80f87a4628731cbb31c58c3784333e877 /crates/ra_mbe/src/tests.rs
parentb949500126f6bd3723d22541adb2f7c8aae206a4 (diff)
Convert bool to ident instead of literal in mbe
Diffstat (limited to 'crates/ra_mbe/src/tests.rs')
-rw-r--r--crates/ra_mbe/src/tests.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
index f2a726538..100ed41f2 100644
--- a/crates/ra_mbe/src/tests.rs
+++ b/crates/ra_mbe/src/tests.rs
@@ -1016,6 +1016,36 @@ fn test_literal() {
1016} 1016}
1017 1017
1018#[test] 1018#[test]
1019fn test_boolean_is_ident() {
1020 parse_macro(
1021 r#"
1022 macro_rules! foo {
1023 ($lit0:literal, $lit1:literal) => { const VALUE: (bool,bool) = ($lit0,$lit1); };
1024 }
1025"#,
1026 )
1027 .assert_expand(
1028 r#"foo!(true,false);"#,
1029 r#"
1030SUBTREE $
1031 IDENT const 14
1032 IDENT VALUE 15
1033 PUNCH : [alone] 16
1034 SUBTREE () 17
1035 IDENT bool 18
1036 PUNCH , [alone] 19
1037 IDENT bool 20
1038 PUNCH = [alone] 21
1039 SUBTREE () 22
1040 IDENT true 29
1041 PUNCH , [joint] 25
1042 IDENT false 31
1043 PUNCH ; [alone] 28
1044"#,
1045 );
1046}
1047
1048#[test]
1019fn test_vis() { 1049fn test_vis() {
1020 parse_macro( 1050 parse_macro(
1021 r#" 1051 r#"