(module main) (fn stdin_result () -> (result string i32) (std.io.read_stdin_result)) (fn stdin_text_or_empty ((value (result string i32))) -> string (match value ((ok text) text) ((err code) ""))) (fn stdin_len_or_code ((value (result string i32))) -> i32 (match value ((ok text) (std.string.len text)) ((err code) code))) (fn stdin_ok_len () -> i32 (std.string.len (unwrap_ok (stdin_result)))) (test "stdin result test runner returns ok" (is_ok (stdin_result))) (test "stdin result payload length matches match" (let value (result string i32) (stdin_result)) (= (std.string.len (unwrap_ok value)) (stdin_len_or_code value))) (test "stdin result match observes ok payload" (let value (result string i32) (stdin_result)) (= (std.string.len (stdin_text_or_empty value)) (stdin_len_or_code value))) (fn main () -> i32 (let value (result string i32) (stdin_result)) (if (is_ok value) (std.string.len (unwrap_ok value)) 1))