slovo/tests/host-io.surface.lower
2026-05-22 08:38:43 +02:00

45 lines
1.0 KiB
Plaintext

program main
fn fixture_path() -> string
string "slovo-exp3-host-io.txt"
fn write_fixture() -> i32
call std.fs.write_text
call fixture_path
string "host io"
fn read_fixture() -> string
call std.fs.read_text
call fixture_path
fn missing_env() -> string
call std.env.get
string "SLOVO_EXP3_MISSING"
fn arg_count_plus_one() -> i32
binary +
call std.process.argc
int 1
fn main() -> i32
call std.io.eprint
string "exp-3 host io"
call std.io.print_string
call std.process.arg
int 0
call std.io.print_string
call read_fixture
call std.fs.write_text
call fixture_path
string "host io"
test "missing env returns empty string"
binary =
call missing_env
string ""
test "argc is not negative"
binary <
int 0
call arg_count_plus_one
test "write text returns success"
binary =
call write_fixture
int 0
test "read text returns written text"
binary =
call read_fixture
string "host io"