summaryrefslogtreecommitdiff
path: root/tests/typ/code/assoc.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-05-18 00:36:11 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-18 00:36:11 +0200
commit8b58171d7ca036d71b32749286c251cc91bdd10e (patch)
tree4594ab5088edf8eec44f3bafe3fb8fecb13ac61b /tests/typ/code/assoc.typ
parent8d67c0ca5eb3486dde97fd281bd4a51d535c600c (diff)
Reorganize test cases
Diffstat (limited to 'tests/typ/code/assoc.typ')
-rw-r--r--tests/typ/code/assoc.typ18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/typ/code/assoc.typ b/tests/typ/code/assoc.typ
new file mode 100644
index 00000000..19c56951
--- /dev/null
+++ b/tests/typ/code/assoc.typ
@@ -0,0 +1,18 @@
+// Test operator associativity.
+// Ref: false
+
+---
+// Math operators are left-associative.
+#test(10 / 2 / 2 == (10 / 2) / 2, true)
+#test(10 / 2 / 2 == 10 / (2 / 2), false)
+#test(1 / 2 * 3, 1.5)
+
+---
+// Assignment is right-associative.
+{
+ let x = 1
+ let y = 2
+ x = y = "ok"
+ test(x, none)
+ test(y, "ok")
+}