Files
catscript/tests/std.cat
T
Minus ef305e7824 std/ tree, use (import) and class syntax
- std/ layout: std/lang/{lexer,parser,checker,compiler}.cat moved from src/catscript
- std/io/io.cat, std/fs/fs.cat, std/math/math.cat modules
- use "path.cat": import another unit (compile+run in the same VM)
- class NAME [extends BASE] ... end: methods, inheritance via __index,
  default new constructor (runs optional init), tables are callable
- examples/classes.cat, tests/std.cat; 48/48 tests
2026-11-16 01:53:53 +00:00

19 lines
523 B
Plaintext

-- tests/std.cat -- exercises the std/ tree (use/import + modules).
use "std/math/math.cat"
use "std/io/io.cat"
use "std/fs/fs.cat"
print("math double:", double(21))
print("math square:", square(9))
print("math abs:", abs(-7))
print("io join:", join({ "a", "b", "c" }, "-"))
local path = "/tmp/catscript_std_test.txt"
fs_write(path, "one")
fs_append(path, "two")
print("fs read:", fs_read(path))
print("fs copy:", fs_copy(path, "/tmp/catscript_std_copy.txt"))
print("fs read2:", fs_read("/tmp/catscript_std_copy.txt"))