polish: clean up the examples and move autofmt sample into dedicated file

This commit is contained in:
Jonathan Kelley committed 2022-06-30 15:19:58 -04:00
1 parent 0aec375371
commit 28a0c67275
5 files changed
+251 -508

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
const SRC: &str = include_str!("./samples/all.rs");
fn body() -> &'static str {
&SRC[6..SRC.len() - 3]
}
fn unindented_body() -> String {
body()
.lines()
.map(|line| match line.strip_prefix(" ") {
Some(line) => line,
None => line,
})
.collect::<Vec<_>>()
.join("\n")
}
#[test]
fn way_and_back() {
let blocks = dioxus_autofmt::fmt_file(SRC).into_iter().next().unwrap();
println!("{}", blocks.formatted);
}