|
|
@@ -60,18 +60,30 @@ TEST(FormatTest, HandlesDateFormatter) {
|
|
|
EXPECT_THAT(fmt.process({{NOW,0}}), Eq("2019-04-04 18:17:20,000"));
|
|
|
}
|
|
|
|
|
|
-TEST(FormatTest, FormatsMicroseconds) {
|
|
|
+TEST(FormatTest, FormatsMilliseconds) {
|
|
|
using testing::Eq;
|
|
|
auto fmt = format::parse_format_string("%d");
|
|
|
EXPECT_THAT(fmt.process({{NOW,123000}}), Eq("2019-04-04 18:17:20,123"));
|
|
|
}
|
|
|
|
|
|
+TEST(FormatTest, ThrowsIfCustomFmtUnterminated) {
|
|
|
+ using testing::Eq;
|
|
|
+ EXPECT_THROW(format::parse_format_string("%d{%"),
|
|
|
+ format_parsing_exception);
|
|
|
+}
|
|
|
+
|
|
|
TEST(FormatTest, SupportsCustomFormatWithBrace) {
|
|
|
using testing::Eq;
|
|
|
auto fmt = format::parse_format_string("%d{%Y}");
|
|
|
EXPECT_THAT(fmt.process({{NOW,0}}), Eq("2019"));
|
|
|
}
|
|
|
|
|
|
+TEST(FormatTest, FormatsCustomMilliseconds) {
|
|
|
+ using testing::Eq;
|
|
|
+ auto fmt = format::parse_format_string("%d{%_ms}");
|
|
|
+ EXPECT_THAT(fmt.process({{NOW,123000}}), Eq("123"));
|
|
|
+}
|
|
|
+
|
|
|
TEST(FormatTest, SupportsISO8601Format) {
|
|
|
using testing::Eq;
|
|
|
auto fmt = format::parse_format_string("%d{ISO8601}");
|