Skip to content

Conversation

philnik777
Copy link
Contributor

This makes the test a bit easier to understand.

@philnik777 philnik777 marked this pull request as ready for review September 9, 2025 07:23
@philnik777 philnik777 requested a review from a team as a code owner September 9, 2025 07:23
@philnik777 philnik777 merged commit cfd24cd into llvm:main Sep 9, 2025
132 of 133 checks passed
@philnik777 philnik777 deleted the string_refactor_test branch September 9, 2025 07:23
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

This makes the test a bit easier to understand.


Full diff: https://github.com/llvm/llvm-project/pull/157429.diff

1 Files Affected:

  • (modified) libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp (+5-11)
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);
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants