about summary refs log tree commit diff
path: root/src/test/rustdoc/macro_rules-matchers.rs
blob: c243094f81ce00c2bcb6cc867e2cd6f5a4a6feb0 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
// This is a regression test for issue #86208.
// It is also a general test of macro_rules! display.

#![crate_name = "foo"]

// @has 'foo/macro.todo.html'
// @has - '//span[@class="macro"]' 'macro_rules!'
// @has - '//span[@class="ident"]' 'todo'
// Note: count = 2 * ('=' + '>') + '+' = 2 * (1 + 1) + 1 = 5
// @count - '//pre[@class="rust macro"]//span[@class="op"]' 5

// @has - '{ ()'
// @has - '//span[@class="op"]' '='
// @has - '//span[@class="op"]' '>'
// @has - '{ ... };'

// @has - '($ ($'
// @has - '//span[@class="ident"]' 'arg'
// @has - ':'
// @has - '//span[@class="ident"]' 'tt'
// @has - '//span[@class="op"]' '+'
// @has - ')'
pub use std::todo;

mod mod1 {
    // @has 'foo/macro.macro1.html'
    // @has - 'macro_rules!'
    // @has - 'macro1'
    // @has - '{ ()'
    // @has - '($ ('
    // @has - 'arg'
    // @has - 'expr'
    // @has - ','
    // @has - '+'
    // @has - ')'
    #[macro_export]
    macro_rules! macro1 {
        () => {};
        ($($arg:expr),+) => { stringify!($($arg),+) };
    }
}