program main
  fn stdin_result() -> (result string i32)
    call std.io.read_stdin_result
  fn stdin_text_or_empty(value: (result string i32)) -> string
    match
      subject
        var value
      arm ok text
        var text
      arm err code
        string ""
  fn stdin_len_or_code(value: (result string i32)) -> i32
    match
      subject
        var value
      arm ok text
        call std.string.len
          var text
      arm err code
        var code
  fn stdin_ok_len() -> i32
    call std.string.len
      unwrap_ok
        call stdin_result
  fn main() -> i32
    local let value: (result string i32)
      call stdin_result
    if
      is_ok
        var value
      call std.string.len
        unwrap_ok
          var value
      int 1
  test "stdin result test runner returns ok"
    is_ok
      call stdin_result
  test "stdin result payload length matches match"
    local let value: (result string i32)
      call stdin_result
    binary =
      call std.string.len
        unwrap_ok
          var value
      call stdin_len_or_code
        var value
  test "stdin result match observes ok payload"
    local let value: (result string i32)
      call stdin_result
    binary =
      call std.string.len
        call stdin_text_or_empty
          var value
      call stdin_len_or_code
        var value
