internal: docs
This commit is contained in:
parent
ef1251f696
commit
84d182c7a2
@ -1,3 +1,6 @@
|
||||
//! Tests specific to declarative macros, aka macros by example. This covers
|
||||
//! both stable `macro_rules!` macros as well as unstable `macro` macros.
|
||||
|
||||
mod tt_conversion;
|
||||
mod matching;
|
||||
mod meta_syntax;
|
||||
@ -25,3 +28,21 @@ macro_rules! stmts {
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wrong_nesting_level() {
|
||||
check(
|
||||
r#"
|
||||
macro_rules! m {
|
||||
($($i:ident);*) => ($i)
|
||||
}
|
||||
m!{a}
|
||||
"#,
|
||||
expect![[r#"
|
||||
macro_rules! m {
|
||||
($($i:ident);*) => ($i)
|
||||
}
|
||||
/* error: expected simple binding, found nested binding `i` */
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
//! Test that `$var:expr` captures function correctly.
|
||||
|
||||
use expect_test::expect;
|
||||
|
||||
use crate::macro_expansion_tests::check;
|
||||
@ -21,21 +23,3 @@ fn unary_minus_is_a_literal() {
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wrong_nesting_level() {
|
||||
check(
|
||||
r#"
|
||||
macro_rules! m {
|
||||
($($i:ident);*) => ($i)
|
||||
}
|
||||
m!{a}
|
||||
"#,
|
||||
expect![[r#"
|
||||
macro_rules! m {
|
||||
($($i:ident);*) => ($i)
|
||||
}
|
||||
/* error: expected simple binding, found nested binding `i` */
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
//! Test for the syntax of macros themselves.
|
||||
|
||||
use expect_test::expect;
|
||||
|
||||
use crate::macro_expansion_tests::check;
|
||||
|
@ -1,3 +1,8 @@
|
||||
//! Unlike rustc, rust-analyzer's syntax tree are not "made of" token trees.
|
||||
//! Rather, token trees are an explicit bridge between the parser and
|
||||
//! (procedural or declarative) macros.
|
||||
//!
|
||||
//! This module tests tt <-> syntax tree conversion specifically
|
||||
use expect_test::expect;
|
||||
|
||||
use crate::macro_expansion_tests::check;
|
||||
|
Loading…
Reference in New Issue
Block a user