[libcxx-commits] [libcxx] Implement P1885R12: `<text_encoding>` header (PR #141312)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Sat May 24 12:19:07 PDT 2025
================
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <text_encoding>
+
+// REQUIRES: std-at-least-c++26
+
+// UNSUPPORTED: no-localization
+
+// class text_encoding
+
+// text_encoding::text_encoding(id) noexcept
+
+// Concerns:
+// 1. text_encoding(id) must be nothrow
+// 2. Constructing an object with a valid id must set mib() and the name to the corresponding value.
+// 3. Constructing an object using id::unknown must set mib() to id::unknown and the name to an empty string.
+// 4. Constructing an object using id::other must set mib() to id::other and the name to an empty string.
+
+#include "test_text_encoding.h"
+#include <cassert>
+#include <string_view>
+#include <text_encoding>
+#include <type_traits>
----------------
Zingam wrote:
```suggestion
#include <cassert>
#include <string_view>
#include <text_encoding>
#include <type_traits>
#include "test_text_encoding.h"
```
Nit: The common practice in tests is first Standard library headers, an empty line, and then any helper headers.
https://github.com/llvm/llvm-project/pull/141312
More information about the libcxx-commits
mailing list