From 8b58171d7ca036d71b32749286c251cc91bdd10e Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 18 May 2021 00:36:11 +0200 Subject: Reorganize test cases --- tests/typ/code/assoc.typ | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/typ/code/assoc.typ (limited to 'tests/typ/code/assoc.typ') 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") +} -- cgit v1.2.3