ifmt.rs 618 B

1234567891011121314151617181920212223242526
  1. use std::borrow::Borrow;
  2. use dioxus_core_macro::*;
  3. #[test]
  4. fn formatting_compiles() {
  5. let x = (0, 1);
  6. // escape sequences work
  7. assert_eq!(
  8. format_args_f!("{x:?} {{}}}}").to_string(),
  9. format!("{:?} {{}}}}", x)
  10. );
  11. assert_eq!(
  12. format_args_f!("{{{{}} {x:?}").to_string(),
  13. format!("{{{{}} {:?}", x)
  14. );
  15. // paths in formating works
  16. assert_eq!(format_args_f!("{x.0}").to_string(), format!("{}", x.0));
  17. // function calls in formatings work
  18. assert_eq!(
  19. format_args_f!("{x.borrow():?}").to_string(),
  20. format!("{:?}", x.borrow())
  21. );
  22. }