Skip to content

Commit

Permalink
fix build & test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zivshek committed Mar 30, 2024
1 parent 861e1fe commit 652b4c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
12 changes: 6 additions & 6 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -2088,17 +2088,17 @@ class year {

class year_month_day {
private:
year year_;
month month_;
day day_;
fmt::year year_;
fmt::month month_;
fmt::day day_;

public:
year_month_day() = default;
constexpr year_month_day(const year& y, const month& m, const day& d) noexcept
: year_(y), month_(m), day_(d) {}
constexpr year year() const noexcept { return year_; }
constexpr month month() const noexcept { return month_; }
constexpr day day() const noexcept { return day_; }
constexpr fmt::year year() const noexcept { return year_; }
constexpr fmt::month month() const noexcept { return month_; }
constexpr fmt::day day() const noexcept { return day_; }
};
#endif

Expand Down
10 changes: 4 additions & 6 deletions test/chrono-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -749,15 +749,14 @@ TEST(chrono_test, unsigned_duration) {
}

TEST(chrono_test, weekday) {
auto loc = get_locale("en_US.UTF-8");
std::locale::global(loc);
std::locale::global(std::locale::classic());
auto sat = fmt::weekday(6);

EXPECT_EQ(fmt::format("{}", sat), "Sat");
EXPECT_EQ(fmt::format("{:%a}", sat), "Sat");
EXPECT_EQ(fmt::format("{:%A}", sat), "Saturday");

loc = get_locale("es_ES.UTF-8");
auto loc = get_locale("es_ES.UTF-8");
std::locale::global(loc);
if (loc != std::locale::classic()) {
auto saturdays = std::vector<std::string>{"sáb", "sá."};
Expand Down Expand Up @@ -1013,8 +1012,7 @@ TEST(chrono_test, out_of_range) {
}

TEST(chrono_test, year_month_day) {
auto loc = get_locale("en_US.UTF-8");
std::locale::global(loc);
std::locale::global(std::locale::classic());

auto year = fmt::year(2024);
auto month = fmt::month(1);
Expand All @@ -1038,7 +1036,7 @@ TEST(chrono_test, year_month_day) {
EXPECT_EQ(fmt::format("{:%Y-%b-%d}", ymd), "2024-Jan-01");
EXPECT_EQ(fmt::format("{:%Y-%B-%d}", ymd), "2024-January-01");

loc = get_locale("es_ES.UTF-8");
auto loc = get_locale("es_ES.UTF-8");
std::locale::global(loc);
if (loc != std::locale::classic()) {
EXPECT_EQ(fmt::format(loc, "{:%b}", month), "ene.");
Expand Down

0 comments on commit 652b4c9

Please sign in to comment.