diff options
Diffstat (limited to 'tests/typ/code/ops.typ')
| -rw-r--r-- | tests/typ/code/ops.typ | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/typ/code/ops.typ b/tests/typ/code/ops.typ index 899ee71c..79743f5d 100644 --- a/tests/typ/code/ops.typ +++ b/tests/typ/code/ops.typ @@ -184,21 +184,19 @@ {"a" not} --- -// Test `with` operator. +// Test `with` method. // Apply positional arguments. #let add(x, y) = x + y -#test((add with (2))(4), 6) - -// Let .. with .. syntax. -#let f = add -#let f with (2) -#test(f(4), 6) +#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) // Make sure that named arguments are overridable. #let inc(x, y: 1) = x + y #test(inc(1), 2) -#let inc with (y: 2) -#test(inc(2), 4) -#test(inc(2, y: 4), 6) +#let inc2 = inc.with(y: 2) +#test(inc2(2), 4) +#test(inc2(2, y: 4), 6) |
