From 9a0d42bdaef883a3acd6b0072a0342ac4095e490 Mon Sep 17 00:00:00 2001 From: LunaAmora Date: Thu, 29 Aug 2024 09:07:29 -0300 Subject: [PATCH] Add test case for read_line when the line ends with a EOF --- tests/golden_tests/io/eof.txt | 1 + tests/golden_tests/io/read_line_eof.bend | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 tests/golden_tests/io/eof.txt create mode 100644 tests/golden_tests/io/read_line_eof.bend diff --git a/tests/golden_tests/io/eof.txt b/tests/golden_tests/io/eof.txt new file mode 100644 index 000000000..f3a34851d --- /dev/null +++ b/tests/golden_tests/io/eof.txt @@ -0,0 +1 @@ +text \ No newline at end of file diff --git a/tests/golden_tests/io/read_line_eof.bend b/tests/golden_tests/io/read_line_eof.bend new file mode 100644 index 000000000..877b63308 --- /dev/null +++ b/tests/golden_tests/io/read_line_eof.bend @@ -0,0 +1,6 @@ +def main: + with IO: + fd <- IO/done_on_err(IO/FS/open("tests/golden_tests/io/eof.txt", "r")) + bytes <- IO/FS/read_line(fd) + txt = String/decode_utf8(bytes) + return wrap(txt)