From 24d513d8917de0a8c23916837e5ea7fbb550db8b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 29 Jan 2022 21:36:25 +0100 Subject: Enable for loop over captured args --- tests/typ/code/for.typ | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/typ/code') diff --git a/tests/typ/code/for.typ b/tests/typ/code/for.typ index 2569f5a7..02bd0a27 100644 --- a/tests/typ/code/for.typ +++ b/tests/typ/code/for.typ @@ -32,6 +32,12 @@ // Should output `2345`. #for v in (1, 2, 3, 4, 5, 6, 7) [#if v >= 2 and v <= 5 { repr(v) }] +// Loop over captured arguments. +#let f1(..args) = for v in args { (repr(v),) } +#let f2(..args) = for k, v in args { (repr(k) + ": " + repr(v),) } +#let f(..args) = join(sep: ", ", ..f1(..args), ..f2(..args)) +#f(1, a: 2) + --- #let out = () -- cgit v1.2.3