]>
git.proxmox.com Git - rustc.git/blob - vendor/syn/tests/macros/mod.rs
1 #[path = "../debug/mod.rs"]
5 use syn
::parse
::{Parse, Result}
;
11 let stderr
= ::std
::io
::stderr();
12 write
!(stderr
.lock(), $
($tt
)*).unwrap();
17 macro_rules
! punctuated
{
19 let mut seq
= ::syn
::punctuated
::Punctuated
::new();
32 macro_rules
! snapshot
{
34 snapshot_impl
!(() $
($args
)*)
39 macro_rules
! snapshot_impl
{
40 (($expr
:ident
) as $t
:ty
, @$snapshot
:literal
) => {
41 let $expr
= crate::macros
::Tokens
::parse
::<$t
>($expr
).unwrap();
42 let debug
= crate::macros
::debug
::Lite(&$expr
);
43 insta
::assert_debug_snapshot
!(debug
, @$snapshot
);
45 (($
($expr
:tt
)*) as $t
:ty
, @$snapshot
:literal
) => {{
46 let syntax_tree
= crate::macros
::Tokens
::parse
::<$t
>($
($expr
)*).unwrap();
47 let debug
= crate::macros
::debug
::Lite(&syntax_tree
);
48 insta
::assert_debug_snapshot
!(debug
, @$snapshot
);
51 (($
($expr
:tt
)*) , @$snapshot
:literal
) => {{
52 let syntax_tree
= $
($expr
)*;
53 let debug
= crate::macros
::debug
::Lite(&syntax_tree
);
54 insta
::assert_debug_snapshot
!(debug
, @$snapshot
);
57 (($
($expr
:tt
)*) $next
:tt $
($rest
:tt
)*) => {
58 snapshot_impl
!(($
($expr
)* $next
) $
($rest
)*)
63 fn parse
<T
: Parse
>(self) -> Result
<T
>;
66 impl<'a
> Tokens
for &'a
str {
67 fn parse
<T
: Parse
>(self) -> Result
<T
> {
72 impl Tokens
for proc_macro2
::TokenStream
{
73 fn parse
<T
: Parse
>(self) -> Result
<T
> {