Skip to content

Commit 376ffec

Browse files
authored
[libc++][format] Enables formattable tests for chrono formatters. (llvm#128356)
These were forgotten when these types were implemented.
1 parent f5f5286 commit 376ffec

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ void test_P1361() {
154154
# if !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB) && !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) && \
155155
!defined(TEST_HAS_NO_FILESYSTEM)
156156
assert_is_formattable<std::chrono::utc_time<std::chrono::microseconds>, CharT>();
157-
//assert_is_formattable<std::chrono::tai_time<std::chrono::microseconds>, CharT>();
158-
//assert_is_formattable<std::chrono::gps_time<std::chrono::microseconds>, CharT>();
157+
assert_is_formattable<std::chrono::tai_time<std::chrono::microseconds>, CharT>();
158+
assert_is_formattable<std::chrono::gps_time<std::chrono::microseconds>, CharT>();
159159

160160
# endif // !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB) && !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) &&
161161
// !defined(TEST_HAS_NO_FILESYSTEM)
@@ -188,8 +188,10 @@ void test_P1361() {
188188
assert_is_formattable<std::chrono::sys_info, CharT>();
189189
assert_is_formattable<std::chrono::local_info, CharT>();
190190

191-
//assert_is_formattable<std::chrono::zoned_time, CharT>();
192-
# endif // !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB)
191+
# if !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) && !defined(TEST_HAS_NO_FILESYSTEM)
192+
assert_is_formattable<std::chrono::zoned_time<std::chrono::microseconds>, CharT>();
193+
# endif // !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) && !defined(TEST_HAS_NO_FILESYSTEM)
194+
# endif // !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB)
193195

194196
#endif // TEST_HAS_NO_LOCALIZATION
195197
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.locking/enable_nonlocking_formatter_optimization.compile.pass.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,13 @@ void test_P1361() {
122122
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::microseconds>);
123123

124124
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::sys_time<std::chrono::microseconds>>);
125-
//static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::utc_time<std::chrono::microseconds>>);
126-
//static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::tai_time<std::chrono::microseconds>>);
127-
//static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::gps_time<std::chrono::microseconds>>);
125+
# if !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB) && !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) && \
126+
!defined(TEST_HAS_NO_FILESYSTEM)
127+
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::utc_time<std::chrono::microseconds>>);
128+
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::tai_time<std::chrono::microseconds>>);
129+
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::gps_time<std::chrono::microseconds>>);
130+
# endif // !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB) && !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) &&
131+
// !defined(TEST_HAS_NO_FILESYSTEM)
128132
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::file_time<std::chrono::microseconds>>);
129133
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::local_time<std::chrono::microseconds>>);
130134

@@ -149,10 +153,14 @@ void test_P1361() {
149153

150154
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::hh_mm_ss<std::chrono::microseconds>>);
151155

152-
//static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::sys_info>);
153-
//static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::local_info>);
156+
# if !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB)
157+
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::sys_info>);
158+
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::local_info>);
154159

155-
//static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::zoned_time>);
160+
# if !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) && !defined(TEST_HAS_NO_FILESYSTEM)
161+
static_assert(!std::enable_nonlocking_formatter_optimization<std::chrono::zoned_time<std::chrono::microseconds>>);
162+
# endif // !defined(TEST_HAS_NO_TIME_ZONE_DATABASE) && !defined(TEST_HAS_NO_FILESYSTEM)
163+
# endif // !defined(TEST_HAS_NO_EXPERIMENTAL_TZDB)
156164

157165
#endif // TEST_HAS_NO_LOCALIZATION
158166
}

0 commit comments

Comments
 (0)