mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
LibLocale+LibJS+ClockSettings: Make date time format APIs infallible
These APIs only perform small allocations, and are only used by LibJS and the time zone settings widget. Callers which could only have failed from these APIs are also made to be infallible here.
This commit is contained in:
parent
0914e86691
commit
7536648498
9 changed files with 183 additions and 191 deletions
|
@ -75,7 +75,7 @@ TEST_CASE(time_zone_name)
|
|||
constexpr auto jan_1_2022 = AK::UnixDateTime::from_seconds_since_epoch(1640995200); // Saturday, January 1, 2022 12:00:00 AM
|
||||
|
||||
for (auto const& test : test_data) {
|
||||
auto time_zone = MUST(Locale::format_time_zone(test.locale, test.time_zone, test.style, jan_1_2022));
|
||||
auto time_zone = Locale::format_time_zone(test.locale, test.time_zone, test.style, jan_1_2022);
|
||||
EXPECT_EQ(time_zone, test.expected_result);
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ TEST_CASE(time_zone_name_dst)
|
|||
constexpr auto sep_19_2022 = AK::UnixDateTime::from_seconds_since_epoch(1663553728); // Monday, September 19, 2022 2:15:28 AM
|
||||
|
||||
for (auto const& test : test_data) {
|
||||
auto time_zone = MUST(Locale::format_time_zone(test.locale, test.time_zone, test.style, sep_19_2022));
|
||||
auto time_zone = Locale::format_time_zone(test.locale, test.time_zone, test.style, sep_19_2022);
|
||||
EXPECT_EQ(time_zone, test.expected_result);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ TEST_CASE(format_time_zone_offset)
|
|||
};
|
||||
|
||||
for (auto const& test : test_data) {
|
||||
auto time_zone = MUST(Locale::format_time_zone(test.locale, test.time_zone, test.style, test.time));
|
||||
auto time_zone = Locale::format_time_zone(test.locale, test.time_zone, test.style, test.time);
|
||||
EXPECT_EQ(time_zone, test.expected_result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue