Skip to content

Commit

Permalink
Add regression test for rust-lang#86208
Browse files Browse the repository at this point in the history
This test does not test the output as well as I would like, but I think
I am limited by htmldocck. I would really just like to strip all the
HTML tags from the output for the sake of the different `@has` checks,
but that doesn't seem to be currently possible.
  • Loading branch information
camelid committed Jun 29, 2021
1 parent 18db83f commit f749d97
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/test/rustdoc/macro_rules-matchers.rs
@@ -0,0 +1,42 @@
// 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 - '//span[@class="op"]' 5

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

// @has - '($('
// @has - '//span[@class="macro-nonterminal"]' '$'
// @has - '//span[@class="macro-nonterminal"]' '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),+) };
}
}

0 comments on commit f749d97

Please sign in to comment.