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

@ -0,0 +1 @@
Expr(Ability(DemandColon(@15), @7), @0)

View file

@ -0,0 +1,4 @@
MEq has
eq b c : a, a -> U64 | a has MEq
1

View file

@ -0,0 +1 @@
Expr(Ability(DemandAlignment(4, @49), @40), @0)

View file

@ -0,0 +1,5 @@
MEq has
eq : a, a -> U64 | a has MEq
neq : a, a -> U64 | a has MEq
1

View file

@ -0,0 +1 @@
Expr(Ability(DemandAlignment(-1, @8), @7), @0)

View file

@ -0,0 +1,4 @@
MEq has
eq : a, a -> U64 | a has MEq
1

View file

@ -0,0 +1 @@
Expr(Ability(DemandName(@12), @7), @0)

View file

@ -0,0 +1 @@
Expr(InParens(End(@3), @0), @0)

View file

@ -0,0 +1 @@
Expr(Space(HasTab, @17), @0)

View file

@ -0,0 +1,2 @@
# comment with a
4

View file

@ -0,0 +1 @@
Expr(DefMissingFinalExpr2(Start(@11), @11), @0)

View file

@ -0,0 +1 @@
Expr(BadOperator("++", @14), @0)

View file

@ -0,0 +1,2 @@
main =
[] ++ []

View file

@ -0,0 +1 @@
Expr(ElmStyleFunction(@2-5, @6), @0)

View file

@ -0,0 +1 @@
Expr(When(Pattern(Start(@28), @28), @0), @0)

View file

@ -0,0 +1,6 @@
when Just 4 is
Just 4 | ->
4
_ ->
2

View file

@ -0,0 +1 @@
Expr(Type(TInlineAlias(ArgumentNotLowercase(@50), @51), @4), @0)

View file

@ -0,0 +1 @@
f : List elem -> [Nil, Cons elem a] as LinkedList U

View file

@ -0,0 +1 @@
Expr(Type(TInlineAlias(NotAnAlias(@39), @40), @4), @0)

View file

@ -0,0 +1 @@
f : List elem -> [Nil, Cons elem a] as a

View file

@ -0,0 +1 @@
Expr(Type(TInlineAlias(Qualified(@39), @58), @4), @0)

View file

@ -0,0 +1 @@
f : List elem -> [Nil, Cons elem a] as Module.LinkedList a

View file

@ -0,0 +1 @@
Expr(Pattern(NotAPattern(@3), @3), @0)

View file

@ -0,0 +1 @@
Expr(When(IfGuard(Start(@28), @27), @0), @0)

View file

@ -0,0 +1,6 @@
when Just 4 is
Just if ->
4
_ ->
2

View file

@ -0,0 +1 @@
Expr(If(Else(@16), @0), @0)

View file

@ -0,0 +1 @@
if 5 == 5 then 2

View file

@ -0,0 +1 @@
Expr(If(IndentThenToken(@17), @8), @0)

View file

@ -0,0 +1,5 @@
x =
if 5 == 5
then 2 else 3
x

View file

@ -0,0 +1 @@
Header(Imports(ListEnd(@87), @65))

View file

@ -0,0 +1,4 @@
app "test-missing-comma"
packages { pf: "platform/main.roc" }
imports [pf.Task Base64]
provides [main, @Foo] to pf

View file

@ -0,0 +1 @@
Expr(BadOperator(":", @21), @0)

View file

@ -0,0 +1,4 @@
main =
(\x -> x) : I64
3

View file

@ -0,0 +1 @@
Expr(BadOperator("**", @13), @0)

View file

@ -0,0 +1,2 @@
main =
5 ** 3

View file

@ -0,0 +1 @@
Expr(Closure(Arg(@3), @0), @0)

View file

@ -0,0 +1 @@
Expr(Closure(Arg(@1), @0), @0)

View file

@ -0,0 +1 @@
Expr(Closure(Arg(@1), @0), @0)

View file

@ -0,0 +1 @@
Expr(Closure(IndentBody(@5), @0), @0)

View file

@ -0,0 +1 @@
Expr(List(End(@7), @0), @0)

View file

@ -0,0 +1 @@
[1, 2, , 3]

View file

@ -0,0 +1 @@
Expr(When(Pattern(List(End(@22), @15), @15), @0), @0)

View file

@ -0,0 +1,2 @@
when [] is
[1, 2, -> ""

View file

@ -0,0 +1 @@
Expr(When(Pattern(List(End(@22), @15), @15), @0), @0)

View file

@ -0,0 +1,3 @@
when [] is
[1, 2,
3] -> ""

View file

@ -0,0 +1 @@
Expr(When(Pattern(List(Rest(@16), @15), @15), @0), @0)

View file

@ -0,0 +1,2 @@
when [] is
[...] -> ""

View file

@ -0,0 +1 @@
Expr(List(End(@6), @0), @0)

View file

@ -0,0 +1 @@
Expr(Str(EndlessMulti(@3), @0), @0)

View file

@ -0,0 +1 @@
"""there is no end

View file

@ -0,0 +1 @@
Expr(When(Arrow(@24), @0), @0)

View file

@ -0,0 +1,6 @@
when Just 4 is
Just when ->
4
_ ->
2

View file

@ -0,0 +1 @@
Expr(Closure(Pattern(PInParens(End(@4), @1), @1), @0), @0)

View file

@ -0,0 +1 @@
Expr(Closure(Pattern(PInParens(End(@5), @1), @1), @0), @0)

View file

@ -0,0 +1 @@
Expr(Closure(Pattern(PInParens(End(@2), @1), @1), @0), @0)

View file

@ -0,0 +1 @@
Expr(Closure(Pattern(PInParens(End(@4), @1), @1), @0), @0)

View file

@ -0,0 +1 @@
Expr(Type(TRecord(End(@13), @4), @4), @0)

View file

@ -0,0 +1 @@
f : { a: Int,

View file

@ -0,0 +1 @@
Expr(Type(TRecord(Field(@6), @4), @4), @0)

View file

@ -0,0 +1 @@
Expr(Type(TRecord(End(@11), @4), @4), @0)

View file

@ -0,0 +1 @@
f : { foo bar }

View file

@ -0,0 +1 @@
Expr(Type(TRecord(End(@5), @4), @4), @0)

View file

@ -0,0 +1 @@
Expr(Type(TRecord(IndentEnd(@5), @4), @4), @0)

View file

@ -0,0 +1,2 @@
f : {
foo : I64,

View file

@ -0,0 +1 @@
Expr(Type(TRecord(Space(HasTab, @10), @4), @4), @0)

View file

@ -0,0 +1 @@
f : { foo }

View file

@ -0,0 +1 @@
Expr(Str(EndlessSingle(@1), @0), @0)

View file

@ -0,0 +1 @@
"there is no end

View file

@ -0,0 +1 @@
Header(Space(HasMisplacedCarriageReturn, @1))

View file

@ -0,0 +1 @@
Expr(Type(TTagUnion(End(@9), @4), @4), @0)

View file

@ -0,0 +1 @@
f : [Yes,

View file

@ -0,0 +1 @@
Expr(Type(TTagUnion(End(@5), @4), @4), @0)

View file

@ -0,0 +1 @@
Expr(Type(TTagUnion(End(@5), @4), @4), @0)

View file

@ -0,0 +1 @@
Expr(Type(TTagUnion(End(@11), @4), @4), @0)

View file

@ -0,0 +1 @@
Expr(TrailingOperator(@2), @0)

View file

@ -0,0 +1 @@
Expr(BadOperator("::", @2), @0)

View file

@ -0,0 +1,4 @@
f :: I64
f = 42
f

Some files were not shown because too many files have changed in this diff Show more