diff options
| author | Malo <57839069+MDLC01@users.noreply.github.com> | 2024-06-16 11:35:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-16 09:35:18 +0000 |
| commit | 34550220aee087271769fb9e5d94d1faebe243c1 (patch) | |
| tree | ec2b737f906d8d1e1429471bfadf54fb18fc02bf /tests/suite/scripting | |
| parent | f25308d1ebd6554d35d512584ca4c3034f230240 (diff) | |
Add hints to array destructuring error messages (#4400)
Diffstat (limited to 'tests/suite/scripting')
| -rw-r--r-- | tests/suite/scripting/destructuring.typ | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/suite/scripting/destructuring.typ b/tests/suite/scripting/destructuring.typ index 0a3c1c54..9d28c195 100644 --- a/tests/suite/scripting/destructuring.typ +++ b/tests/suite/scripting/destructuring.typ @@ -119,12 +119,22 @@ // Error: 7-14 expected pattern, found function call #let (a.at(0),) = (1,) +--- destructuring-let-empty-array --- +#let () = () + +--- destructuring-let-empty-array-too-many-elements --- +// Error: 6-8 too many elements to destructure +// Hint: 6-8 the provided array has a length of 2, but the pattern expects an empty array +#let () = (1, 2) + --- destructuring-let-array-too-few-elements --- // Error: 13-14 not enough elements to destructure +// Hint: 13-14 the provided array has a length of 2 #let (a, b, c) = (1, 2) --- destructuring-let-array-too-few-elements-with-sink --- // Error: 7-10 not enough elements to destructure +// Hint: 7-10 the provided array has a length of 2 #let (..a, b, c, d) = (1, 2) --- destructuring-let-array-bool-invalid --- @@ -183,6 +193,7 @@ --- destructuring-let-array-trailing-placeholders --- // Trailing placeholders. // Error: 10-11 not enough elements to destructure +// Hint: 10-11 the provided array has a length of 1 #let (a, _, _, _, _) = (1,) #test(a, 1) @@ -350,8 +361,10 @@ --- issue-3275-destructuring-loop-over-2d-array-1 --- // Error: 10-11 not enough elements to destructure +// Hint: 10-11 the provided array has a length of 1 #for (x, y) in ((1,), (2,)) {} --- issue-3275-destructuring-loop-over-2d-array-2 --- // Error: 6-12 too many elements to destructure +// Hint: 6-12 the provided array has a length of 3, but the pattern expects 2 elements #for (x, y) in ((1,2,3), (4,5,6)) {} |
