macro_rules! tests {
($(
$ident:ident {
$($tt:tt)*
}
)*) => {
$(
#[test]
fn $ident() {
let entry: fsmentry_core::FsmEntry = syn::parse_quote! {
$($tt)*
};
let mut pretty = prettyplease::unparse(&syn::parse_quote! {
#entry
});
pretty.insert_str(0, "#![cfg_attr(rustfmt, rustfmt_skip)]\n");
expect_test::expect_file![
concat!("check_compile/", stringify!($ident), ".rs")
].assert_eq(&pretty);
}
)*
#[allow(unused)]
mod check_compile {
$(
mod $ident;
)*
}
};
}
tests! {
full {
#[derive(Debug)]
#[fsmentry(
entry = pub(crate) MyEntry,
unsafe(true),
)]
pub enum State<'a, T>
where
T: Ord
{
PopulatedIsland(String),
DesertIsland,
Fountain(&'a mut T)
-fountain2bridge->
BeautifulBridge(Vec<u8>)
-bridge2tombstone->
Tombstone(char),
Fountain -> Plank -> UnmarkedGrave,
Stream -> BeautifulBridge,
Stream -> Plank,
}
}
simple {
enum Road {
Start -> Fork -> End,
Fork -> Start,
}
}
}