diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-08 23:36:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-08 23:36:20 +0200 |
| commit | 0c74290519ee999002e9cc99ba3d272d68e1014f (patch) | |
| tree | 8134b8aeabb9d5af4c50667de6b2c6532c6b8422 /tests | |
| parent | 02b586cc36fad58a622ecb439e1cf3a76a347207 (diff) | |
Compare functions and templates by identity
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/code/ops.typ | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/typ/code/ops.typ b/tests/typ/code/ops.typ index 6d788df1..58fd957f 100644 --- a/tests/typ/code/ops.typ +++ b/tests/typ/code/ops.typ @@ -112,6 +112,7 @@ --- // Test equality operators. +// Most things compare by value. #test(1 == "hi", false) #test(1 == 1.0, true) #test(30% == 30% + 0cm, true) @@ -124,6 +125,17 @@ #test((a: 2 - 1.0, b: 2) == (b: 2, a: 1), true) #test("a" != "a", false) +// Functions compare by identity. +#test(test == test, true) +#test((() => {}) == (() => {}), false) + +// Templates also compare by identity. +#let t = [a] +#test(t == t, true) +#test([] == [], false) +#test([] == [a], false) +#test([a] == [a], false) + --- // Test comparison operators. |
