Skip to content

Commit 984e89e

Browse files
committed
Skip std::format tests on unsupported platforms
1 parent 202f559 commit 984e89e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/proxy_dispatch_tests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ TEST(ProxyDispatchTests, TestFreeAsMemDispatch) {
829829
}
830830

831831
TEST(ProxyDispatchTests, TestSubstitutionDispatch) {
832+
#if __cpp_lib_format
832833
struct Base : pro::facade_builder //
833834
::add_skill<pro::skills::format> //
834835
::build {};
@@ -844,4 +845,7 @@ TEST(ProxyDispatchTests, TestSubstitutionDispatch) {
844845
pro::proxy<Base> p3 = std::move(p1);
845846
ASSERT_FALSE(p1.has_value());
846847
ASSERT_EQ(std::format("{}", *p3), "123");
848+
#else
849+
GTEST_SKIP() << "std::format not available";
850+
#endif // __cpp_lib_format
847851
}

tests/proxy_format_tests.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <gtest/gtest.h>
55
#include <proxy/proxy.h>
66

7+
#if __cpp_lib_format
78
namespace proxy_format_tests_details {
89

910
struct NonFormattable : pro::facade_builder::build {};
@@ -29,17 +30,26 @@ static_assert(
2930
} // namespace proxy_format_tests_details
3031

3132
namespace details = proxy_format_tests_details;
33+
#endif // __cpp_lib_format
3234

3335
TEST(ProxyFormatTests, TestFormat) {
36+
#if __cpp_lib_format
3437
int v = 123;
3538
pro::proxy<details::Formattable> p = &v;
3639
ASSERT_EQ(std::format("{}", *p), "123");
3740
ASSERT_EQ(std::format("{:*<6}", *p), "123***");
41+
#else
42+
GTEST_SKIP() << "std::format not available";
43+
#endif // __cpp_lib_format
3844
}
3945

4046
TEST(ProxyFormatTests, TestWformat) {
47+
#if __cpp_lib_format
4148
int v = 123;
4249
pro::proxy<details::Formattable> p = &v;
4350
ASSERT_EQ(std::format(L"{}", *p), L"123");
4451
ASSERT_EQ(std::format(L"{:*<6}", *p), L"123***");
52+
#else
53+
GTEST_SKIP() << "std::format not available";
54+
#endif // __cpp_lib_format
4555
}

0 commit comments

Comments
 (0)