Skip to content

Commit

Permalink
🩹 (LogKit): tests - fix warning unknown escape sequence '\'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Jun 7, 2022
1 parent 7f0ab37 commit 83462d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions libs/LogKit/tests/LogKit_test_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ TEST_F(LogKitFormatTest, formatFullContentStringOnly)
{
log_info("Hello, World");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z]+\\] \\[.+:[0-9]+\\] .+() > .+"));
}

TEST_F(LogKitFormatTest, formatFullContentStringAdditionalArguments)
{
log_info("Hello, World. %i %s!", 42, "FTW");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z]+\\] \\[.+:[0-9]+\\] .+() > .+"));
}

TEST_F(LogKitFormatTest, formatFullContentStringEmpty)
{
log_info("");

EXPECT_THAT(spy_sink_output, Not(HasSubstr(" > ")));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z]+\\] \\[.+:[0-9]+\\] .+()"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z]+\\] \\[.+:[0-9]+\\] .+()"));
}

TEST_F(LogKitFormatTest, formatTimeHumanReadable)
Expand All @@ -65,7 +65,7 @@ TEST_F(LogKitFormatTest, formatTimeHumanReadable)
auto time = std::string(leka::logger::buffer::timestamp.data());

// Format: hhh:mm:ss:μμμ
ASSERT_THAT(time, MatchesRegex("[0-9]{3}:[0-9]{2}:[0-9]{2}\.[0-9]{3}"));
ASSERT_THAT(time, MatchesRegex("[0-9]{3}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}"));
}

TEST_F(LogKitFormatTest, formatLevel)
Expand Down
18 changes: 9 additions & 9 deletions libs/LogKit/tests/LogKit_test_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,47 +82,47 @@ TEST_F(LogKitTest, formatFullContentStringOnly)
{
log_debug("Hello, World");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));

log_info("Hello, World");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));

log_error("Hello, World");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
}

TEST_F(LogKitTest, formatFullContentStringAdditionalArguments)

{
log_debug("Hello, World. %i %s!", 42, "FTW");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));

log_info("Hello, World. %i %s!", 42, "FTW");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));

log_error("Hello, World. %i %s!", 42, "FTW");

EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+() > .+"));
}

TEST_F(LogKitTest, formatFullContentStringEmpty)
{
log_debug("");

EXPECT_THAT(spy_sink_output, Not(HasSubstr(" > ")));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+()"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+()"));

log_info("");

EXPECT_THAT(spy_sink_output, Not(HasSubstr(" > ")));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+()"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+()"));

log_error("");

EXPECT_THAT(spy_sink_output, Not(HasSubstr(" > ")));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+()"));
EXPECT_THAT(spy_sink_output, MatchesRegex("[0-9:\\.]+ \\[[A-Z ]+\\] \\[.+:[0-9]+\\] .+()"));
}

0 comments on commit 83462d5

Please sign in to comment.