Files
dioxus/packages/autofmt/tests/error_handling.rs
T
Jonathan Kelley 828cc502f1 Fix: #2604, Fix: #2240, Fix: #2341, Fix #1355 - Better error handling and and spaces handling in autofmt (#2736)
* add new autofmt sample
* Feat: implement rustfmt::skip support for rsx
* generally improve error handling with better expect messages
* wip: nested rsx formatting and expression formatting
* nested rsx formatting works
* collapse autofmt crate
* cast indent through macros
* use proper whitespace
* no more eating comments!
* Use proper error handling
2024-07-30 18:36:13 -07:00

22 lines
639 B
Rust

#[test]
fn no_parse() {
let src = include_str!("./partials/no_parse.rsx");
assert!(syn::parse_file(src).is_err());
}
#[test]
fn parses_but_fmt_fails() {
let src = include_str!("./partials/wrong.rsx");
let file = syn::parse_file(src).unwrap();
let formatted = dioxus_autofmt::try_fmt_file(src, &file, Default::default());
assert!(&formatted.is_err());
}
#[test]
fn parses_and_is_okay() {
let src = include_str!("./partials/okay.rsx");
let file = syn::parse_file(src).unwrap();
let formatted = dioxus_autofmt::try_fmt_file(src, &file, Default::default()).unwrap();
assert_ne!(formatted.len(), 0);
}