From 1247c6d8e102cc40c3ec0d913a28ea904e4e4dec Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:49:18 -0300 Subject: Add `std` module for names in the standard library (#4038) --- tests/ref/std-math.png | Bin 0 -> 298 bytes tests/suite/foundations/std.typ | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/ref/std-math.png create mode 100644 tests/suite/foundations/std.typ (limited to 'tests') diff --git a/tests/ref/std-math.png b/tests/ref/std-math.png new file mode 100644 index 00000000..f7cecf47 Binary files /dev/null and b/tests/ref/std-math.png differ 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) $ -- cgit v1.2.3