|
|
@@ -103,6 +103,20 @@ TEST(PatternLayoutTest, FormatsCustomMilliseconds) {
|
|
|
EXPECT_THAT(DoFormat("%d{%_ms}", {{NOW,123000}}), Eq("123"));
|
|
|
}
|
|
|
|
|
|
+MATCHER(IsTimeZoneOffsetLike, "") {
|
|
|
+ if (arg[0] != '+' && arg[0] != '-') {
|
|
|
+ (*result_listener) << "A timezone should be +/- hhmm";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ int const hours = std::stoi(arg.substr(1, 2));
|
|
|
+ int const minutes = std::stoi(arg.substr(3, 2));
|
|
|
+ return hours <= 12 && minutes < 60;
|
|
|
+}
|
|
|
+
|
|
|
+TEST(PatternLayoutTest, FormatsTimeZone) {
|
|
|
+ EXPECT_THAT(DoFormat("%d{%z}", {{NOW,0}}), IsTimeZoneOffsetLike());
|
|
|
+}
|
|
|
+
|
|
|
TEST(PatternLayoutTest, SupportsISO8601Format) {
|
|
|
using testing::Eq;
|
|
|
EXPECT_THAT(DoFormat("%d{ISO8601}", {{NOW,0}}),
|