diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-10-27 13:24:37 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-10-27 13:25:15 +0200 |
| commit | cbfd9884a94b55486f9b07296f23a01b34d080bd (patch) | |
| tree | fe6ea6d08b6977715c878158f5d2514efe7593cb /tests/typ/compiler | |
| parent | fa81c3ece019b4667713d34cd5d7d23804045439 (diff) | |
Fix argument parsing bug
Things like `luma(1, key: "val")` didn't produce an error before because `args.finish()?` wasn't called. This changes `args: Args` to `args: &mut Args` to make it impossible for that to happen.
Diffstat (limited to 'tests/typ/compiler')
| -rw-r--r-- | tests/typ/compiler/array.typ | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/typ/compiler/array.typ b/tests/typ/compiler/array.typ index 4191d6ff..2ce47158 100644 --- a/tests/typ/compiler/array.typ +++ b/tests/typ/compiler/array.typ @@ -249,6 +249,10 @@ #test((2, 1, 3, -10, -5, 8, 6, -7, 2).sorted(key: x => x * x), (1, 2, 2, 3, -5, 6, -7, 8, -10)) --- +// Error: 12-18 unexpected argument +#().sorted(x => x) + +--- // Test the `zip` method. #test(().zip(()), ()) #test((1,).zip(()), ()) @@ -262,7 +266,7 @@ #test((1,).zip((2,), (3,)), ((1, 2, 3),)) #test((1, 2, 3).zip(), ((1,), (2,), (3,))) #test(array.zip(()), ()) -#test(array.zip(("a", "b")), (("a",), ("b",))) + --- // Test the `enumerate` method. @@ -290,6 +294,14 @@ #test(("Hello", "World", "Hi", "There").dedup(key: x => x.at(0)), ("Hello", "World", "There")) --- +// Error: 9-26 unexpected argument: val +#().zip(val: "applicable") + +--- +// Error: 13-30 unexpected argument: val +#().zip((), val: "applicable") + +--- // Error: 32-37 cannot divide by zero #(1, 2, 0, 3).sorted(key: x => 5 / x) |
