Add macro_rules tests
This commit is contained in:
parent
5d973d2e8c
commit
c750442e04
2 changed files with 33 additions and 0 deletions
16
tests/source/macro_rules.rs
Normal file
16
tests/source/macro_rules.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
macro_rules! m {
|
||||
($expr :expr, $func : ident) => {
|
||||
{
|
||||
let x = $expr;
|
||||
$func (
|
||||
x
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
() => { };
|
||||
|
||||
( $item:ident ) => {
|
||||
mod macro_item { struct $item ; }
|
||||
};
|
||||
}
|
17
tests/target/macro_rules.rs
Normal file
17
tests/target/macro_rules.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
macro_rules! m {
|
||||
($expr: expr, $func: ident) => {
|
||||
{
|
||||
let x = $expr;
|
||||
$func(x)
|
||||
}
|
||||
};
|
||||
|
||||
() => {
|
||||
};
|
||||
|
||||
($item: ident) => {
|
||||
mod macro_item {
|
||||
struct $item;
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue