diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-03-18 23:36:18 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-03-18 23:43:58 +0100 |
| commit | beca01c826ee51c9ee6d5eadd7e5ef10f7fb9f58 (patch) | |
| tree | e0ebb40b8775bba3b4be7bc47dceda3d349e2ac0 /tests/typ/code/ops.typ | |
| parent | 77d153d315a2a5909840ebcd47491e4cef14428b (diff) | |
Methods
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) |
