summaryrefslogtreecommitdiff
path: root/tests/typ/code
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-04-19 16:37:16 +0200
committerLaurenz <laurmaedje@gmail.com>2022-04-19 16:37:16 +0200
commit7a2cc3e7d29d16c5cf9b5a93a688e14da93c8662 (patch)
tree8ca787c56b84b83f5d34ee7b4701c0e8f4778753 /tests/typ/code
parent255d4c620f39133b40a9132843781f2a620a6008 (diff)
Field access
Diffstat (limited to 'tests/typ/code')
-rw-r--r--tests/typ/code/field.typ24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/typ/code/field.typ b/tests/typ/code/field.typ
new file mode 100644
index 00000000..b30d72e0
--- /dev/null
+++ b/tests/typ/code/field.typ
@@ -0,0 +1,24 @@
+// Test field access.
+// Ref: false
+
+---
+#let dict = (nothing: "ness", hello: "world")
+#test(dict.nothing, "ness")
+{
+ let world = dict
+ .hello
+
+ test(world, "world")
+}
+
+---
+// Error: 2-13 dictionary does not contain key: "invalid"
+{(:).invalid}
+
+---
+// Error: 2-7 cannot access field on boolean
+{false.ok}
+
+---
+// Error: 8-12 expected identifier, found boolean
+{false.true}