diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-20 14:05:17 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-20 14:05:35 +0100 |
| commit | dd331f007cb9c9968605f8d3eaef8fb498c21322 (patch) | |
| tree | f1b1490758ec53fd204724a325158d16c980d131 /tests/typ/compiler | |
| parent | 40561e57fbbc68becac07acd54a34f94f591f277 (diff) | |
Rewrite parser
Diffstat (limited to 'tests/typ/compiler')
| -rw-r--r-- | tests/typ/compiler/array.typ | 5 | ||||
| -rw-r--r-- | tests/typ/compiler/block.typ | 4 | ||||
| -rw-r--r-- | tests/typ/compiler/call.typ | 6 | ||||
| -rw-r--r-- | tests/typ/compiler/closure.typ | 10 | ||||
| -rw-r--r-- | tests/typ/compiler/dict.typ | 11 | ||||
| -rw-r--r-- | tests/typ/compiler/field.typ | 3 | ||||
| -rw-r--r-- | tests/typ/compiler/for.typ | 9 | ||||
| -rw-r--r-- | tests/typ/compiler/if.typ | 6 | ||||
| -rw-r--r-- | tests/typ/compiler/import.typ | 20 | ||||
| -rw-r--r-- | tests/typ/compiler/let.typ | 8 | ||||
| -rw-r--r-- | tests/typ/compiler/spread.typ | 2 | ||||
| -rw-r--r-- | tests/typ/compiler/while.typ | 4 |
12 files changed, 53 insertions, 35 deletions
diff --git a/tests/typ/compiler/array.typ b/tests/typ/compiler/array.typ index ccde8598..e01f8896 100644 --- a/tests/typ/compiler/array.typ +++ b/tests/typ/compiler/array.typ @@ -208,17 +208,16 @@ // Error: 3 expected closing paren {(} -// Error: 2-3 expected expression, found closing paren +// Error: 2-3 unexpected closing paren {)} -// Error: 4 expected comma // Error: 4-6 unexpected end of block comment {(1*/2)} // Error: 6-8 invalid number suffix {(1, 1u 2)} -// Error: 3-4 expected expression, found comma +// Error: 3-4 unexpected comma {(,1)} // Missing expression makes named pair incomplete, making this an empty array. diff --git a/tests/typ/compiler/block.typ b/tests/typ/compiler/block.typ index 7cf1f8be..7fb7738b 100644 --- a/tests/typ/compiler/block.typ +++ b/tests/typ/compiler/block.typ @@ -126,10 +126,12 @@ // Should output `3`. { - // Error: 7-10 expected identifier, found string + // Error: 6 expected identifier + // Error: 10 expected block for "v" // Error: 8 expected keyword `in` + // Error: 22 expected block for v let z = 1 + 2 z diff --git a/tests/typ/compiler/call.typ b/tests/typ/compiler/call.typ index 7ea0a998..087e4694 100644 --- a/tests/typ/compiler/call.typ +++ b/tests/typ/compiler/call.typ @@ -44,7 +44,7 @@ } --- -// Error: 28-47 duplicate argument +// Error: 28-34 duplicate argument #set text(family: "Arial", family: "Helvetica") --- @@ -70,7 +70,8 @@ #f[1](2) --- -// Error: 7-8 expected expression, found colon +// Error: 7 expected expression +// Error: 8 expected expression #func(:) // Error: 10-12 unexpected end of block comment @@ -102,5 +103,4 @@ --- // Error: 2:1 expected quote -// Error: 2:1 expected closing paren #func("] diff --git a/tests/typ/compiler/closure.typ b/tests/typ/compiler/closure.typ index c7321204..f1604b19 100644 --- a/tests/typ/compiler/closure.typ +++ b/tests/typ/compiler/closure.typ @@ -146,6 +146,16 @@ } --- +// Error: 11-12 duplicate parameter +#let f(x, x) = none + +--- +// Error: 14-15 duplicate parameter +// Error: 23-24 duplicate parameter +// Error: 35-36 duplicate parameter +#let f(a, b, a: none, b: none, c, b) = none + +--- // Error: 6-16 expected identifier, named pair or argument sink, found keyed pair {(a, "named": b) => none} diff --git a/tests/typ/compiler/dict.typ b/tests/typ/compiler/dict.typ index 0170cb8b..f9a0b369 100644 --- a/tests/typ/compiler/dict.typ +++ b/tests/typ/compiler/dict.typ @@ -56,11 +56,11 @@ #test(dict, (a: 3, b: 1)) --- -// Error: 24-32 pair has duplicate key +// Error: 24-29 duplicate key {(first: 1, second: 2, first: 3)} --- -// Error: 17-23 pair has duplicate key +// Error: 17-20 duplicate key {(a: 1, "b": 2, "a": 3)} --- @@ -72,8 +72,11 @@ // Error: 4-5 expected named or keyed pair, found integer // Error: 5 expected comma // Error: 12-16 expected identifier or string, found boolean -// Error: 17-18 expected expression, found colon -{(:1 b:"", true::)} +// Error: 17 expected expression +{(:1 b:"", true:)} + +// Error: 3-8 expected identifier or string, found binary expression +{(a + b: "hey")} --- // Error: 3-15 cannot mutate a temporary value diff --git a/tests/typ/compiler/field.typ b/tests/typ/compiler/field.typ index 78439ae0..0195c6d8 100644 --- a/tests/typ/compiler/field.typ +++ b/tests/typ/compiler/field.typ @@ -36,5 +36,6 @@ = A --- -// Error: 8-12 expected identifier, found boolean +// Error: 8 expected identifier +// Error: 8 expected semicolon or line break {false.true} diff --git a/tests/typ/compiler/for.typ b/tests/typ/compiler/for.typ index f63b870e..7a530b73 100644 --- a/tests/typ/compiler/for.typ +++ b/tests/typ/compiler/for.typ @@ -94,7 +94,7 @@ // Error: 5 expected identifier #for -// Error: 7 expected identifier +// Error: 5 expected identifier #for// // Error: 5 expected identifier @@ -106,17 +106,18 @@ // Error: 10 expected expression #for v in -// Error: 15 expected body +// Error: 15 expected block #for v in iter // Error: 5 expected identifier #for v in iter {} -// Error: 7-10 expected identifier, found string +// Error: 6 expected identifier +// Error: 10 expected block A#for "v" thing -// Error: 6-9 expected identifier, found string +// Error: 5 expected identifier #for "v" in iter {} // Error: 7 expected keyword `in` diff --git a/tests/typ/compiler/if.typ b/tests/typ/compiler/if.typ index 0d87c689..3b35ebd8 100644 --- a/tests/typ/compiler/if.typ +++ b/tests/typ/compiler/if.typ @@ -112,7 +112,7 @@ // Error: 4 expected expression {if} -// Error: 6 expected body +// Error: 6 expected block #if x // Error: 1-6 unexpected keyword `else` @@ -124,11 +124,11 @@ x {} // Should output `something`. -// Error: 6 expected body +// Error: 6 expected block #if x something // Should output `A thing.` -// Error: 19 expected body +// Error: 19 expected block A#if false {} else thing #if a []else [b] diff --git a/tests/typ/compiler/import.typ b/tests/typ/compiler/import.typ index 6f2ac459..6b2d8075 100644 --- a/tests/typ/compiler/import.typ +++ b/tests/typ/compiler/import.typ @@ -81,21 +81,16 @@ This is never reached. #import --- -// Error: 26-29 expected identifier, found string +// Error: 26-29 unexpected string #import "module.typ": a, "b", c --- -// Error: 22 expected import items -#import "module.typ": - ---- -// Error: 23-24 expected expression, found assignment operator -// Error: 24 expected import items +// Error: 23-24 unexpected equals sign #import "module.typ": = --- // An additional trailing comma. -// Error: 31-32 expected expression, found comma +// Error: 31-32 unexpected comma #import "module.typ": a, b, c,, --- @@ -105,7 +100,7 @@ This is never reached. --- // A star in the list. -// Error: 26-27 expected expression, found star +// Error: 26-27 unexpected star #import "module.typ": a, *, b --- @@ -114,5 +109,10 @@ This is never reached. #import "module.typ": *, a --- -// Error: 13-17 expected identifier, found named pair +// Error: 14-15 unexpected colon +// Error: 16-17 unexpected integer #import "": a: 1 + +--- +// Error: 14 expected comma +#import "": a b diff --git a/tests/typ/compiler/let.typ b/tests/typ/compiler/let.typ index d4f9510a..3a879ce7 100644 --- a/tests/typ/compiler/let.typ +++ b/tests/typ/compiler/let.typ @@ -39,7 +39,8 @@ Three // Error: 5 expected identifier {let} -// Error: 6-9 expected identifier, found string +// Error: 5 expected identifier +// Error: 5 expected semicolon or line break #let "v" // Error: 7 expected semicolon or line break @@ -48,7 +49,8 @@ Three // Error: 9 expected expression #let v = -// Error: 6-9 expected identifier, found string +// Error: 5 expected identifier +// Error: 5 expected semicolon or line break #let "v" = 1 // Terminated because expression ends. @@ -61,7 +63,7 @@ Three #let v5 = (1, 2 + ; Five --- -// Error: 13 expected body +// Error: 13 expected equals sign #let func(x) // Error: 15 expected expression diff --git a/tests/typ/compiler/spread.typ b/tests/typ/compiler/spread.typ index ff661ead..244e9fb9 100644 --- a/tests/typ/compiler/spread.typ +++ b/tests/typ/compiler/spread.typ @@ -60,7 +60,7 @@ #min(.."nope") --- -// Error: 8-14 expected identifier, named pair or argument sink, found spread +// Error: 10-14 expected identifier, found boolean #let f(..true) = none --- diff --git a/tests/typ/compiler/while.typ b/tests/typ/compiler/while.typ index 3c28a32a..d495a84a 100644 --- a/tests/typ/compiler/while.typ +++ b/tests/typ/compiler/while.typ @@ -49,12 +49,12 @@ // Error: 7 expected expression {while} -// Error: 9 expected body +// Error: 9 expected block #while x // Error: 7 expected expression #while x {} -// Error: 9 expected body +// Error: 9 expected block #while x something |
