samples.rs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. many_exprs,
  47. shorthand,
  48. docsite,
  49. letsome,
  50. fat_exprs,
  51. nested,
  52. staged,
  53. misplaced
  54. ];