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