samples.rs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. macro_rules! twoway {
  2. (
  3. $(
  4. // doc attrs
  5. $( #[doc = $doc:expr] )*
  6. $name:ident,
  7. )*
  8. ) => {
  9. $(
  10. $( #[doc = $doc] )*
  11. #[test]
  12. fn $name() {
  13. let src = include_str!(concat!("./samples/", stringify!($name), ".rsx"));
  14. let formatted = dioxus_autofmt::fmt_file(src, Default::default());
  15. let out = dioxus_autofmt::apply_formats(src, formatted);
  16. // normalize line endings
  17. let out = out.replace("\r", "");
  18. let src = src.replace("\r", "");
  19. pretty_assertions::assert_eq!(&src, &out);
  20. }
  21. )*
  22. };
  23. }
  24. twoway![
  25. attributes,
  26. collapse_expr,
  27. comments,
  28. commentshard,
  29. complex,
  30. emoji,
  31. ifchain_forloop,
  32. immediate_expr,
  33. key,
  34. long_exprs,
  35. long,
  36. manual_props,
  37. messy_indent,
  38. multirsx,
  39. raw_strings,
  40. reallylong,
  41. simple,
  42. t2,
  43. tiny,
  44. tinynoopt,
  45. trailing_expr,
  46. ];