dioxus/packages/autofmt/tests/samples.rs

45 lines
865 B
Rust
Raw Normal View History

macro_rules! twoway {
2023-01-13 00:29:31 +00:00
(
$(
// doc attrs
$( #[doc = $doc:expr] )*
$name:ident
),*
) => {
$(
$( #[doc = $doc] )*
#[test]
fn $name() {
let src = include_str!(concat!("./samples/", stringify!($name), ".rsx"));
let formatted = dioxus_autofmt::fmt_file(src);
let out = dioxus_autofmt::apply_formats(src, formatted);
pretty_assertions::assert_eq!(&src, &out);
}
)*
};
}
2023-01-13 00:29:31 +00:00
twoway![
simple,
comments,
attributes,
manual_props,
complex,
tiny,
tinynoopt,
long,
key,
multirsx,
commentshard,
emoji,
messy_indent,
2023-01-13 18:51:12 +00:00
long_exprs,
ifchain_forloop,
2023-01-14 01:16:06 +00:00
t2,
2023-01-17 00:36:50 +00:00
reallylong,
immediate_expr,
2023-01-18 00:24:29 +00:00
collapse_expr,
trailing_expr
2023-01-13 00:29:31 +00:00
];