[libcxx-commits] [libcxx] [libc++][NFC] Inline function in string.cons/copy_alloc.pass.cpp that is used only once (PR #157429)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 8 04:17:54 PDT 2025
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/157429
This makes the test a bit easier to understand.
>From d1ce33626610d8e9797589e729410c40f2ee50d8 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 8 Sep 2025 13:16:57 +0200
Subject: [PATCH] [libc++][NFC] Inline function in
string.cons/copy_alloc.pass.cpp that is used only once
---
.../basic.string/string.cons/copy_alloc.pass.cpp | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
index b0045cb4afbba..c4fd5afe83a44 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
@@ -65,16 +65,6 @@ template <typename T, typename U>
bool operator!=(const poca_alloc<T>& lhs, const poca_alloc<U>& rhs) {
return lhs.imp != rhs.imp;
}
-
-template <class S>
-TEST_CONSTEXPR_CXX20 void test_assign(S& s1, const S& s2) {
- try {
- s1 = s2;
- } catch (std::bad_alloc&) {
- return;
- }
- assert(false);
-}
#endif
template <class S>
@@ -122,7 +112,11 @@ TEST_CONSTEXPR_CXX20 bool test() {
assert(s2 == p2);
imp2.deactivate();
- test_assign(s1, s2);
+ try {
+ s1 = s2;
+ assert(false);
+ } catch (std::bad_alloc&) {
+ }
assert(s1 == p1);
assert(s2 == p2);
}
More information about the libcxx-commits
mailing list