summaryrefslogtreecommitdiff
path: root/tests/typ/code/dict.typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/code/dict.typ')
-rw-r--r--tests/typ/code/dict.typ23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/typ/code/dict.typ b/tests/typ/code/dict.typ
index 80097761..182f53d9 100644
--- a/tests/typ/code/dict.typ
+++ b/tests/typ/code/dict.typ
@@ -17,10 +17,14 @@
---
// Test lvalue and rvalue access.
{
- let dict = (a: 1, b: 1)
- dict("b") += 1
- dict("c") = 3
- test(dict, (a: 1, b: 2, c: 3))
+ 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)
}
---
@@ -58,3 +62,14 @@
// 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"
+}