diff options
| author | Leedehai <18319900+Leedehai@users.noreply.github.com> | 2023-12-28 08:32:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-28 13:32:51 +0000 |
| commit | 99f32a45e523cb7b7e8c9e948f8984d0372752d6 (patch) | |
| tree | 9e094d4c44e3aba2f4fd473e09238fc51e0878e8 /tests | |
| parent | f94708d202785922f9ffbc6b3beb50a5d636682b (diff) | |
Add a test to verify .with() applies to sinks (#3071)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compiler/ops.typ | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/typ/compiler/ops.typ b/tests/typ/compiler/ops.typ index 64736228..4d3b071f 100644 --- a/tests/typ/compiler/ops.typ +++ b/tests/typ/compiler/ops.typ @@ -302,6 +302,7 @@ // Apply positional arguments. #let add(x, y) = x + y #test(add.with(2)(3), 5) +#test(add.with(2, 3)(), 5) #test(add.with(2).with(3)(), 5) #test((add.with(2))(4), 6) #test((add.with(2).with(3))(), 5) @@ -313,3 +314,14 @@ #let inc2 = inc.with(y: 2) #test(inc2(2), 4) #test(inc2(2, y: 4), 6) + +// Apply arguments to an argument sink. +#let times(..sink) = { + let res = sink.pos().product() + if sink.named().at("negate", default: false) { res *= -1 } + res +} +#test((times.with(2, negate: true).with(5))(), -10) +#test((times.with(2).with(5).with(negate: true))(), -10) +#test((times.with(2).with(5, negate: true))(), -10) +#test((times.with(2).with(negate: true))(5), -10) |
