Move syntax tests to a dedicated crate

* test_fmt moves out of fmt crate
* test_parse _mostly_ moves out of parse crate and into `test_snapshots.rs` (some simple tests remain)
* now there's only two fuzz targets, fuzz_expr and fuzz_module, that cover both parsing and formatting
* added a system to auto-add new snapshot entries for new test files
* took some commented-out tests in `test_parse` and converted them to snapshot tests
* moved test_fmt's verification of formatting consistency into test_snapshots
* fixed a huge derp on my part where the fmt fuzzer in #4758 was completely useless (broken by refactoring just prior to submitting the PR)
* fixed a formatting bug found by fuzzing (bound_variable.expr.roc) - that I missed earlier due to ^^^ that derp
* no longer have roc_test_utils as a dependency in fmt - which was causing problems for the wasm build
This commit is contained in:
Joshua Warner 2022-12-26 12:50:31 -08:00
parent f0b3c3eb08
commit bfeddc470a
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
701 changed files with 1929 additions and 1516 deletions

View file

@ -288,9 +288,18 @@ impl<'a> Formattable for TypeAnnotation<'a> {
buf.push(')')
}
}
BoundVariable(v) => buf.push_str(v),
Wildcard => buf.push('*'),
Inferred => buf.push('_'),
BoundVariable(v) => {
buf.indent(indent);
buf.push_str(v)
}
Wildcard => {
buf.indent(indent);
buf.push('*')
}
Inferred => {
buf.indent(indent);
buf.push('_')
}
TagUnion { tags, ext } => {
fmt_collection(buf, indent, Braces::Square, *tags, newlines);
@ -355,8 +364,10 @@ impl<'a> Formattable for TypeAnnotation<'a> {
ann.format_with_options(buf, parens, newlines, indent);
fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent);
}
Malformed(raw) => buf.push_str(raw),
Malformed(raw) => {
buf.indent(indent);
buf.push_str(raw)
}
}
}
}