summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-09 00:11:03 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-09 00:11:03 +0200
commit778aa4e7dfd616743f3b9e18e10bb53f5d441f5f (patch)
treea4fd2a78a0e750d5607ce6cbe1705354ab5179bc /tests
parent1927cc86dae1df300b3472c52f1777baf637dc6f (diff)
Mutable field access
Diffstat (limited to 'tests')
-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"
+}