From 78e80113b1c0c9643af8911754dbbc73e1efec83 Mon Sep 17 00:00:00 2001 From: Akarsh Date: Thu, 2 Apr 2026 01:08:56 +0530 Subject: [PATCH 1/2] Add tests for tm_ostream functionality and UTF-8 support --- tests/System/IO/tm_ostream_test.cpp | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/System/IO/tm_ostream_test.cpp b/tests/System/IO/tm_ostream_test.cpp index d5984fd19..53bb6c5de 100644 --- a/tests/System/IO/tm_ostream_test.cpp +++ b/tests/System/IO/tm_ostream_test.cpp @@ -189,3 +189,55 @@ TEST_CASE ("cout/cerr") { } TEST_MEMORY_LEAK_ALL + +TEST_CASE ("tm_ostream opened on file") { + url file_path= url_temp ("lolly_test_output.txt"); + string content = "Hello from tm_ostream file test!"; + + { + tm_ostream out (file_path); + CHECK (out->is_writable () == true); + out << content; + } + + string loaded= ""; + load_string (file_path, loaded, false); + CHECK (loaded == content); + + remove (file_path); +} + +TEST_CASE ("tm_ostream file with utf-8 filename") { + url file_path= url_temp ("lolly_utf8_棒棒糖.txt"); + string content = "utf-8 content"; + + { + tm_ostream out (file_path); + CHECK (out->is_writable () == true); + out << content; + } + + string loaded= ""; + load_string (file_path, loaded, false); + CHECK (loaded == content); + + remove (file_path); +} + +TEST_CASE ("tm_ostream interoperability with load_string and save_string") { + url file_path= url_temp ("lolly_interop_test.txt"); + string content = "interoperability test content"; + + save_string (file_path, content, false); + + { + tm_ostream out (file_path); + CHECK (out->is_writable () == true); + } + + string loaded= ""; + load_string (file_path, loaded, false); + CHECK (loaded == content); + + remove (file_path); +} From d4be42af49c0d71531da91fa844f3783f449a020 Mon Sep 17 00:00:00 2001 From: Akarsh Date: Thu, 2 Apr 2026 01:15:13 +0530 Subject: [PATCH 2/2] Fix memory leak test case in tm_ostream_test --- tests/System/IO/tm_ostream_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/System/IO/tm_ostream_test.cpp b/tests/System/IO/tm_ostream_test.cpp index 53bb6c5de..463ad1817 100644 --- a/tests/System/IO/tm_ostream_test.cpp +++ b/tests/System/IO/tm_ostream_test.cpp @@ -188,7 +188,7 @@ TEST_CASE ("cout/cerr") { cerr << "棒棒糖" << LF; } -TEST_MEMORY_LEAK_ALL +TEST_MEMORY_LEAK_ALL TEST_CASE ("tm_ostream opened on file") { url file_path= url_temp ("lolly_test_output.txt");