feat: format components properly

This commit is contained in:
Jonathan Kelley committed 2022-04-24 13:12:20 -04:00
1 parent 2a1970b3a9
commit f9d9f85924
3 files changed
+101 -7

No files matched your search

+36 -2
View File
@@ -53,9 +53,43 @@ fn parse_comment() {
}
"#;
// let parsed: CallBody = syn::parse_str(block).ok()?;
let parsed: TokenStream2 = syn::parse_str(block).unwrap();
dbg!(parsed);
}
#[test]
fn formats_component() {
let block = r#"
Component {
adsasd: "asd", // this is a comment
onclick: move |_| {
let blah = 120;
let blah = 120;
},
}
"#;
let formatted = fmt_block(block).unwrap();
print!("{formatted}");
}
#[test]
fn formats_component_man_props() {
let block = r#"
Component {
..MyProps {
val: 123
},
adsasd: "asd", // this is a comment
onclick: move |_| {
let blah = 120;
},
}
"#;
let formatted = fmt_block(block).unwrap();
print!("{formatted}");
}