summaryrefslogtreecommitdiff
path: root/tests/suite
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2024-04-30 09:49:18 -0300
committerGitHub <noreply@github.com>2024-04-30 12:49:18 +0000
commit1247c6d8e102cc40c3ec0d913a28ea904e4e4dec (patch)
tree16882e51a21702fbde207f873ea313926d1f0106 /tests/suite
parent44bc51ba4fef66b7778668b3877a65425ac2eedc (diff)
Add `std` module for names in the standard library (#4038)
Diffstat (limited to 'tests/suite')
-rw-r--r--tests/suite/foundations/std.typ31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/suite/foundations/std.typ b/tests/suite/foundations/std.typ
new file mode 100644
index 00000000..48a69502
--- /dev/null
+++ b/tests/suite/foundations/std.typ
@@ -0,0 +1,31 @@
+// Test 'std', a module with the standard library
+
+--- std-basic-access ---
+#test(std.grid, grid)
+#test(std.calc, calc)
+
+--- std-import ---
+#import std: grid as banana
+#test(grid, banana)
+
+--- std-of-shadowed ---
+#let my-grid = grid[a][b]
+#let grid = "oh no!"
+#test(my-grid.func(), std.grid)
+
+--- std-shadowing ---
+#let std = 5
+// Error: 6-10 cannot access fields on type integer
+#std.grid
+
+--- std-mutation ---
+// Error: 3-6 cannot mutate a constant: std
+#(std = 10)
+
+--- std-shadowed-mutation ---
+#let std = 10
+#(std = 7)
+#test(std, 7)
+
+--- std-math ---
+$ std.rect(x + y = 5) $