diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-29 13:37:25 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-29 14:18:13 +0100 |
| commit | 0efe669278a5e1c3f2985eba2f3360e91159c54a (patch) | |
| tree | 502712857c48f0decb5e698257c0a96d358a436e /tests/typ/code/dict.typ | |
| parent | 836692e73cff0356e409a9ba5b4887b86809d4ca (diff) | |
Reorganize library and tests
Diffstat (limited to 'tests/typ/code/dict.typ')
| -rw-r--r-- | tests/typ/code/dict.typ | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/tests/typ/code/dict.typ b/tests/typ/code/dict.typ deleted file mode 100644 index d791f77b..00000000 --- a/tests/typ/code/dict.typ +++ /dev/null @@ -1,75 +0,0 @@ -// Test dictionaries. -// Ref: false - ---- -// Ref: true - -// Empty -{(:)} - -// Two pairs and string key. -#let dict = (normal: 1, "spacy key": 2) -#dict - -#test(dict.normal, 1) -#test(dict("spacy key"), 2) - ---- -// Test lvalue and rvalue access. -{ - let dict = (a: 1, "b b": 1) - dict("b b") += 1 - dict.state = (ok: true, err: false) - test(dict, (a: 1, "b b": 2, state: (ok: true, err: false))) - test(dict.state.ok, true) - dict("state").ok = false - test(dict.state.ok, false) - test(dict.state.err, false) -} - ---- -// Test rvalue missing key. -{ - let dict = (a: 1, b: 2) - // Error: 11-20 dictionary does not contain key "c" - let x = dict("c") -} - ---- -// Missing lvalue is automatically none-initialized. -{ - let dict = (:) - dict("b") += 1 - test(dict, (b: 1)) -} - ---- -// Error: 24-32 pair has duplicate key -{(first: 1, second: 2, first: 3)} - ---- -// Error: 17-23 pair has duplicate key -{(a: 1, "b": 2, "a": 3)} - ---- -// Simple expression after already being identified as a dictionary. -// Error: 9-10 expected named or keyed pair, found identifier -{(a: 1, b)} - -// Identified as dictionary due to initial colon. -// Error: 4-5 expected named or keyed pair, found integer -// Error: 5 expected comma -// Error: 12-16 expected identifier or string, found boolean -// Error: 17-18 expected expression, found colon -{(:1 b:"", true::)} - ---- -// Error: 3-15 cannot mutate a temporary value -{ (key: value).other = "some" } - ---- -{ - let object = none - // Error: 3-9 expected dictionary, found none - object.property = "value" -} |
