Skip to content

Commit cfd24cd

Browse files
authored
[libc++][NFC] Inline function in string.cons/copy_alloc.pass.cpp that is used only once (#157429)
This makes the test a bit easier to understand.
1 parent 9344a7c commit cfd24cd

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ template <typename T, typename U>
6565
bool operator!=(const poca_alloc<T>& lhs, const poca_alloc<U>& rhs) {
6666
return lhs.imp != rhs.imp;
6767
}
68-
69-
template <class S>
70-
TEST_CONSTEXPR_CXX20 void test_assign(S& s1, const S& s2) {
71-
try {
72-
s1 = s2;
73-
} catch (std::bad_alloc&) {
74-
return;
75-
}
76-
assert(false);
77-
}
7868
#endif
7969

8070
template <class S>
@@ -122,7 +112,11 @@ TEST_CONSTEXPR_CXX20 bool test() {
122112
assert(s2 == p2);
123113

124114
imp2.deactivate();
125-
test_assign(s1, s2);
115+
try {
116+
s1 = s2;
117+
assert(false);
118+
} catch (std::bad_alloc&) {
119+
}
126120
assert(s1 == p1);
127121
assert(s2 == p2);
128122
}

0 commit comments

Comments
 (0)