Skip to content

Commit bcf9f55

Browse files
committed
Fold some tests into the runtime tests
1 parent 03fd879 commit bcf9f55

File tree

3 files changed

+36
-32
lines changed

3 files changed

+36
-32
lines changed

libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,6 @@ void test_rt() {
194194
}
195195

196196
TestTypes::TestType::reset();
197-
}
198-
199-
int main(int, char**) {
200-
test();
201-
static_assert(test());
202-
203-
{
204-
test_rt();
205-
}
206197

207198
{
208199
test_throwing_ctor();
@@ -213,6 +204,15 @@ int main(int, char**) {
213204
test_reference_extension();
214205
}
215206
#endif
207+
}
208+
209+
int main(int, char**) {
210+
test();
211+
static_assert(test());
212+
213+
{
214+
test_rt();
215+
}
216216

217217
return 0;
218218
}

libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ bool test_rt() {
226226
static_assert(std::is_nothrow_move_constructible<optional<NoThrowMove>>::value, "");
227227
}
228228

229+
{
230+
test_throwing_ctor();
231+
}
232+
233+
#if TEST_STD_VER >= 26
234+
{
235+
test_reference_extension();
236+
}
237+
#endif
238+
229239
return true;
230240
}
231241

@@ -237,13 +247,5 @@ int main(int, char**) {
237247
test_rt();
238248
}
239249

240-
{
241-
test_throwing_ctor();
242-
}
243-
244-
{
245-
test_reference_extension();
246-
}
247-
248250
return 0;
249251
}

libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ constexpr void test_rvalueT(U arg) {
4747
};
4848
}
4949

50+
TEST_CONSTEXPR_CXX26 void test_throwing() {
51+
#ifndef TEST_HAS_NO_EXCEPTIONS
52+
{
53+
try {
54+
Z z(3);
55+
optional<Z> opt(std::move(z));
56+
assert(false);
57+
} catch (int i) {
58+
assert(i == 6);
59+
}
60+
}
61+
#endif
62+
}
63+
5064
void test_rt() {
5165
{
5266
typedef TestTypes::TestType T;
@@ -57,6 +71,7 @@ void test_rt() {
5771
assert(static_cast<bool>(opt) == true);
5872
assert(opt.value().value == 3);
5973
}
74+
6075
{
6176
typedef ExplicitTestTypes::TestType T;
6277
static_assert(!std::is_convertible<T&&, optional<T>>::value, "");
@@ -67,6 +82,7 @@ void test_rt() {
6782
assert(static_cast<bool>(opt) == true);
6883
assert(opt.value().value == 3);
6984
}
85+
7086
{
7187
typedef TestTypes::TestType T;
7288
T::reset();
@@ -78,20 +94,10 @@ void test_rt() {
7894
assert(static_cast<bool>(opt) == true);
7995
assert(opt.value().value == 3);
8096
}
81-
}
8297

83-
TEST_CONSTEXPR_CXX26 void test_throwing() {
84-
#ifndef TEST_HAS_NO_EXCEPTIONS
8598
{
86-
try {
87-
Z z(3);
88-
optional<Z> opt(std::move(z));
89-
assert(false);
90-
} catch (int i) {
91-
assert(i == 6);
92-
}
99+
test_throwing();
93100
}
94-
#endif
95101
}
96102

97103
constexpr bool test() {
@@ -132,9 +138,5 @@ int main(int, char**) {
132138
test_rt();
133139
}
134140

135-
{
136-
test_throwing();
137-
}
138-
139141
return 0;
140142
}

0 commit comments

Comments
 (0)