[libcxx-commits] [libcxx] [NFC][libc++][exceptions] Adds tests for LWG3112. (PR #100881)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 27 10:39:46 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 803eaf29267c6aae9162d1a83a4a2ae508b440d3 eb7eaa6d5a218ae8c4b71ecc157c66af686604d1 --extensions cpp -- libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp
index d9640b0e1d..45dc0d8293 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp
@@ -21,13 +21,13 @@
 #include "test_macros.h"
 
 int main(int, char**) {
-    std::string what_arg("test message\0With embedded NUL");
-    std::system_error se(make_error_code(std::errc::not_a_directory), what_arg);
-    assert(se.code() == std::make_error_code(std::errc::not_a_directory));
-    std::string what_message(se.what());
-    assert(what_message.find(what_arg) != std::string::npos);
-    assert(what_message.find(what_arg.c_str()) != std::string::npos);
-    assert(what_message.find("Not a directory") != std::string::npos);
-
-    return 0;
+  std::string what_arg("test message\0With embedded NUL");
+  std::system_error se(make_error_code(std::errc::not_a_directory), what_arg);
+  assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+  std::string what_message(se.what());
+  assert(what_message.find(what_arg) != std::string::npos);
+  assert(what_message.find(what_arg.c_str()) != std::string::npos);
+  assert(what_message.find("Not a directory") != std::string::npos);
+
+  return 0;
 }
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp
index f7babf49e5..77e6fc42e1 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp
@@ -21,14 +21,13 @@
 #include "test_macros.h"
 
 int main(int, char**) {
-    std::string what_arg("test message\0With embedded NUL");
-    std::system_error se(static_cast<int>(std::errc::not_a_directory),
-                         std::generic_category(), what_arg);
-    assert(se.code() == std::make_error_code(std::errc::not_a_directory));
-    std::string what_message(se.what());
-    assert(what_message.find(what_arg) != std::string::npos);
-    assert(what_message.find(what_arg.c_str()) != std::string::npos);
-    assert(what_message.find("Not a directory") != std::string::npos);
-
-    return 0;
+  std::string what_arg("test message\0With embedded NUL");
+  std::system_error se(static_cast<int>(std::errc::not_a_directory), std::generic_category(), what_arg);
+  assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+  std::string what_message(se.what());
+  assert(what_message.find(what_arg) != std::string::npos);
+  assert(what_message.find(what_arg.c_str()) != std::string::npos);
+  assert(what_message.find("Not a directory") != std::string::npos);
+
+  return 0;
 }
diff --git a/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp b/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
index 8981807274..1e5bb033d1 100644
--- a/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
@@ -34,7 +34,7 @@ void test_constructors() {
   using namespace fs;
 
   // The string returned by "filesystem_error::what() must contain runtime_error::what().c_str()
-  const std::string what_arg = "Hello World\0with embedded NUL";
+  const std::string what_arg      = "Hello World\0with embedded NUL";
   const std::string what_contains = std::runtime_error(what_arg).what();
   assert(what_contains.find(what_arg) != std::string::npos);
   auto CheckWhat = [what_contains](filesystem_error const& e) {

``````````

</details>


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


More information about the libcxx-commits mailing list