From d7838ab1288672a67fc746a89eb6a04c7ed8c8cf Mon Sep 17 00:00:00 2001 From: JustForFun88 <100504524+JustForFun88@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:21:40 +0500 Subject: Add `reduce` method to `array` (#3911) --- tests/suite/foundations/array.typ | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/suite/foundations/array.typ b/tests/suite/foundations/array.typ index 3992d75e..336c5a67 100644 --- a/tests/suite/foundations/array.typ +++ b/tests/suite/foundations/array.typ @@ -492,3 +492,16 @@ --- array-unclosed --- // Error: 3-4 unclosed delimiter #{(} + +--- array-reduce --- +// Test the `reduce` method. +#test(().reduce(grid), none) +#test((1, 2, 3, 4).reduce((s, x) => s + x), 10) + +--- array-reduce-missing-reducer --- +// Error: 2-13 missing argument: reducer +#().reduce() + +--- array-reduce-unexpected-argument --- +// Error: 19-21 unexpected argument +#(1, 2, 3).reduce(() => none) \ No newline at end of file -- cgit v1.2.3