[libcxx-commits] [libcxx] [libc++] Move more tests into test/extensions (PR #152975)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 11 01:59:41 PDT 2025
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 HEAD~1 HEAD --extensions cpp -- libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_lock_guard.pass.cpp libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_missing_unlock.verify.cpp libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_requires_capability.pass.cpp libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp libcxx/test/extensions/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp libcxx/test/extensions/libcxx/odr_signature.exceptions.sh.cpp libcxx/test/extensions/libcxx/odr_signature.hardening.sh.cpp libcxx/test/extensions/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
index e9794acc8..ca3beacec 100644
--- a/libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
+++ b/libcxx/test/extensions/clang/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
@@ -24,9 +24,7 @@
std::mutex m;
int foo __attribute__((guarded_by(m)));
-void increment() __attribute__((requires_capability(m))) {
- foo++;
-}
+void increment() __attribute__((requires_capability(m))) { foo++; }
int main(int, char**) {
m.lock();
diff --git a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp
index 652783fc6..6d7a04c91 100644
--- a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp
+++ b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp
@@ -26,27 +26,25 @@
#include "wide_temp_file.h"
int main(int, char**) {
- std::wstring temp = get_wide_temp_file_name();
- {
- std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- double x = 0;
- fs << 3.25;
- fs.seekg(0);
- fs >> x;
- assert(x == 3.25);
- }
- _wremove(temp.c_str());
- {
- std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- double x = 0;
- fs << 3.25;
- fs.seekg(0);
- fs >> x;
- assert(x == 3.25);
- }
- _wremove(temp.c_str());
-
- return 0;
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+ {
+ std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+
+ return 0;
}
diff --git a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp
index b592492f8..5bf582043 100644
--- a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp
+++ b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp
@@ -26,33 +26,31 @@
#include "wide_temp_file.h"
int main(int, char**) {
- std::wstring temp = get_wide_temp_file_name();
- {
- std::fstream fs;
- assert(!fs.is_open());
- fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- assert(fs.is_open());
- double x = 0;
- fs << 3.25;
- fs.seekg(0);
- fs >> x;
- assert(x == 3.25);
- }
- _wremove(temp.c_str());
- {
- std::wfstream fs;
- assert(!fs.is_open());
- fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- assert(fs.is_open());
- double x = 0;
- fs << 3.25;
- fs.seekg(0);
- fs >> x;
- assert(x == 3.25);
- }
- _wremove(temp.c_str());
-
- return 0;
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::fstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+ {
+ std::wfstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+
+ return 0;
}
diff --git a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
index 18e9b2910..e791184a2 100644
--- a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
+++ b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
@@ -25,24 +25,24 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::ifstream fs(L"test.dat");
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
- // std::ifstream(const wchar_t*, std::ios_base::openmode) is tested in
- // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
- // which creates writable files.
- {
- std::wifstream fs(L"test.dat");
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
- // std::wifstream(const wchar_t*, std::ios_base::openmode) is tested in
- // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
- // which creates writable files.
-
- return 0;
+ {
+ std::ifstream fs(L"test.dat");
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ // std::ifstream(const wchar_t*, std::ios_base::openmode) is tested in
+ // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
+ // which creates writable files.
+ {
+ std::wifstream fs(L"test.dat");
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ // std::wifstream(const wchar_t*, std::ios_base::openmode) is tested in
+ // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
+ // which creates writable files.
+
+ return 0;
}
diff --git a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
index 3fa8a29e2..ea5054b3d 100644
--- a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
+++ b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
@@ -25,30 +25,30 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::ifstream fs;
- assert(!fs.is_open());
- char c = 'a';
- fs >> c;
- assert(fs.fail());
- assert(c == 'a');
- fs.open(L"test.dat");
- assert(fs.is_open());
- fs >> c;
- assert(c == 'r');
- }
- {
- std::wifstream fs;
- assert(!fs.is_open());
- wchar_t c = L'a';
- fs >> c;
- assert(fs.fail());
- assert(c == L'a');
- fs.open(L"test.dat");
- assert(fs.is_open());
- fs >> c;
- assert(c == L'r');
- }
-
- return 0;
+ {
+ std::ifstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == 'a');
+ fs.open(L"test.dat");
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == 'r');
+ }
+ {
+ std::wifstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == L'a');
+ fs.open(L"test.dat");
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == L'r');
+ }
+
+ return 0;
}
diff --git a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
index 3730e7364..aabdfe407 100644
--- a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
+++ b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
@@ -26,41 +26,41 @@
#include "wide_temp_file.h"
int main(int, char**) {
- std::wstring temp = get_wide_temp_file_name();
- {
- std::ofstream fs(temp.c_str());
- fs << 3.25;
- }
- {
- std::ifstream fs(temp.c_str());
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
- {
- std::ifstream fs(temp.c_str(), std::ios_base::out);
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
- _wremove(temp.c_str());
- {
- std::wofstream fs(temp.c_str());
- fs << 3.25;
- }
- {
- std::wifstream fs(temp.c_str());
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
- {
- std::wifstream fs(temp.c_str(), std::ios_base::out);
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
- _wremove(temp.c_str());
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::ofstream fs(temp.c_str());
+ fs << 3.25;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::ifstream fs(temp.c_str(), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+ {
+ std::wofstream fs(temp.c_str());
+ fs << 3.25;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs(temp.c_str(), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp
index bfbbd5322..600901008 100644
--- a/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp
+++ b/libcxx/test/extensions/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp
@@ -26,41 +26,41 @@
#include "wide_temp_file.h"
int main(int, char**) {
- std::wstring temp = get_wide_temp_file_name();
- {
- std::ofstream fs;
- assert(!fs.is_open());
- char c = 'a';
- fs << c;
- assert(fs.fail());
- fs.open(temp.c_str());
- assert(fs.is_open());
- fs << c;
- }
- {
- std::ifstream fs(temp.c_str());
- char c = 0;
- fs >> c;
- assert(c == 'a');
- }
- _wremove(temp.c_str());
- {
- std::wofstream fs;
- assert(!fs.is_open());
- wchar_t c = L'a';
- fs << c;
- assert(fs.fail());
- fs.open(temp.c_str());
- assert(fs.is_open());
- fs << c;
- }
- {
- std::wifstream fs(temp.c_str());
- wchar_t c = 0;
- fs >> c;
- assert(c == L'a');
- }
- _wremove(temp.c_str());
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::ofstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ char c = 0;
+ fs >> c;
+ assert(c == 'a');
+ }
+ _wremove(temp.c_str());
+ {
+ std::wofstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ wchar_t c = 0;
+ fs >> c;
+ assert(c == L'a');
+ }
+ _wremove(temp.c_str());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/extensions/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp b/libcxx/test/extensions/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
index c856c931f..3f9c66033 100644
--- a/libcxx/test/extensions/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
+++ b/libcxx/test/extensions/libcxx/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
@@ -19,17 +19,16 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- std::ostreambuf_iterator<char> i(nullptr);
- assert(i.failed());
- }
+int main(int, char**) {
+ {
+ std::ostreambuf_iterator<char> i(nullptr);
+ assert(i.failed());
+ }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
- {
- std::ostreambuf_iterator<wchar_t> i(nullptr);
- assert(i.failed());
- }
+ {
+ std::ostreambuf_iterator<wchar_t> i(nullptr);
+ assert(i.failed());
+ }
#endif
return 0;
``````````
</details>
https://github.com/llvm/llvm-project/pull/152975
More information about the libcxx-commits
mailing list