[libcxx-commits] [libcxx] [libc++] Fix checks for terminal and flushes in std::print() (PR #70321)

Dimitrij Mijoski via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 10 06:34:38 PDT 2026


================
@@ -62,40 +61,19 @@ static void test_basics() {
   FILE* file = std::fopen(filename.c_str(), "wb");
   assert(file);
 
-  // Test writing to a "non-terminal" stream does not call WriteConsoleW.
-  std::__print::__vprint_unicode_windows(file, "Hello", std::make_format_args(), false, false);
-  assert(std::ftell(file) == 5);
-
-  // It's not possible to reliably test whether writing to a "terminal" stream
-  // flushes before writing. Testing flushing a closed stream worked on some
-  // platforms, but was unreliable.
----------------
dimztimz wrote:

`__vprint_unicode_windows` is never ever called with C stream that is not terminal, see the removal of the last parameter. So those cases are removed from the test. Only the cases where the last argument was true remain.

https://github.com/llvm/llvm-project/pull/70321


More information about the libcxx-commits mailing list