Skip to content

Commit 039a058

Browse files
committed
Add a more complete test of rustdoc macro_rules matcher rendering
1 parent f562b24 commit 039a058

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
macro_rules! morestuff {
2+
(
3+
<= "space between most kinds of tokens" : 1 $x + @ :: >>= 'static
4+
"no space inside paren or bracket" : (2 a) [2 a] $(2 $a:tt)*
5+
"space inside curly brace" : { 2 a }
6+
"no space inside empty delimiters" : () [] {}
7+
"no space before comma or semicolon" : a, (a), { a }, a; [T; 0];
8+
"the three repetition specifiers" : $(@)*, $(@)+, $(@)?
9+
"repetition separators" : $(@)|*, $(@)|+, $(@)==*, $(@)static*
10+
"plus or star cannot be a repetition separator" : $(@)+ * $(@)* +
11+
"no space between ident and paren" : let _ = f(0) + f[0] + Struct {};
12+
"space between keyword and paren" : return (a,) & for x in (..)
13+
"some special case keywords" : pub(crate), fn() -> u8, Self(0, 0) =>
14+
) => { ... };
15+
}

src/test/rustdoc/macro-generated-macro.rs

+15
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,18 @@ make_macro!(groups fn {}() {foo[0]});
2222

2323
// @snapshot macro_linebreak_pre macro_generated_macro/macro.linebreak.html //pre/text()
2424
make_macro!(linebreak 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28);
25+
26+
// @snapshot macro_morestuff_pre macro_generated_macro/macro.morestuff.html //pre/text()
27+
make_macro!(morestuff
28+
"space between most kinds of tokens": 1 $x + @ :: >>= 'static
29+
"no space inside paren or bracket": (2 a) [2 a] $(2 $a:tt)*
30+
"space inside curly brace": { 2 a }
31+
"no space inside empty delimiters": () [] {}
32+
"no space before comma or semicolon": a, (a), { a }, a; [T; 0];
33+
"the three repetition specifiers": $(@)*, $(@)+, $(@)?
34+
"repetition separators": $(@)|*, $(@)|+, $(@)==*, $(@)static*
35+
"plus or star cannot be a repetition separator": $(@)+ * $(@)* +
36+
"no space between ident and paren": let _ = f(0) + f[0] + Struct {};
37+
"space between keyword and paren": return (a,) & for x in (..)
38+
"some special case keywords": pub(crate), fn() -> u8, Self(0, 0)
39+
);

0 commit comments

Comments
 (0)