Browse Source

Add tests for default date format.
- Failing: FormatsMicroseconds

Sam Jaffe 6 years ago
parent
commit
c46bb2ef0c
1 changed files with 15 additions and 0 deletions
  1. 15 0
      test/format_test.cxx

+ 15 - 0
test/format_test.cxx

@@ -50,3 +50,18 @@ TEST(FormatTest, CatchesRawContentAfterFmt) {
   auto fmt = format::parse_format_string("%%TEST");
   EXPECT_THAT(fmt.process({}), Eq("%TEST"));
 }
+
+// Thursday, April 4, 2019 6:17:20 PM GMT
+constexpr const int NOW = 1554401840;
+
+TEST(FormatTest, HandlesDateFormatter) {
+  using testing::Eq;
+  auto fmt = format::parse_format_string("%d");
+  EXPECT_THAT(fmt.process({{NOW,0}}), Eq("2019-04-04 18:17:20,000"));
+}
+
+TEST(FormatTest, FormatsMicroseconds) {
+  using testing::Eq;
+  auto fmt = format::parse_format_string("%d");
+  EXPECT_THAT(fmt.process({{NOW,123000}}), Eq("2019-04-04 18:17:20,123"));
+}