[libc-commits] [libc] [libc] implement fputws (PR #196160)
Muhammad Bassiouni via libc-commits
libc-commits at lists.llvm.org
Thu May 7 06:22:22 PDT 2026
================
@@ -0,0 +1,151 @@
+//===-- Unittests for fputws ----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "hdr/errno_macros.h"
+#include "src/stdio/fclose.h"
+#include "src/stdio/ferror.h"
+#include "src/stdio/fopen.h"
+#include "src/stdio/fread.h"
+#include "src/wchar/fputws.h"
+#include "src/wchar/fwide.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/Test.h"
+
+using LlvmLibcFputwsTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+
+TEST_F(LlvmLibcFputwsTest, WriteWideString) {
+ auto FILENAME =
+ libc_make_test_file_path(APPEND_LIBC_TEST("fputws_string.test"));
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
+ ASSERT_FALSE(file == nullptr);
+
+ // String with 1, 2, 3, and 4-byte UTF-8 characters
+ // Hello, ¢€𐍈 world!\n
+ constexpr wchar_t STR[] = L"Hello, ¢€𐍈 world!\n";
----------------
bassiounix wrote:
2 bytes size limit on windows as addressed before in the previous PR
https://github.com/llvm/llvm-project/pull/196160
More information about the libc-commits
mailing list