ifmt.rs 688 B

1234567891011121314151617181920212223242526272829
  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).to_string()
  10. );
  11. assert_eq!(
  12. format_args_f!("{{{{}} {x:?}").to_string(),
  13. format!("{{{{}} {:?}", x).to_string()
  14. );
  15. // paths in formating works
  16. assert_eq!(
  17. format_args_f!("{x.0}").to_string(),
  18. format!("{}", x.0).to_string()
  19. );
  20. // function calls in formatings work
  21. assert_eq!(
  22. format_args_f!("{x.borrow():?}").to_string(),
  23. format!("{:?}", x.borrow()).to_string()
  24. );
  25. }