Skip to content

Commit ecd49ba

Browse files
authored
Merge pull request motis-project#34 from sncf-connect-tech/accept_string_view_as_extra_param
Adding unit test accept_string_view_as_extra_param
2 parents 492a0e3 + f5a1963 commit ecd49ba

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/.idea
44
/deps
55
/docs/conf.py
6+
/docs/Doxyfile
67
/docs/html
78
/docs/xml
89
/public

.pkg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[docs]
22
[email protected]:motis-project/docs.git
33
branch=main
4-
commit=6f234581cab199d66d070e4de8a32ddba1967b38
4+
commit=75dc89a53e9c2d78574fc0ffda698e69f1682ed2
55
[googletest]
66
[email protected]:motis-project/googletest.git
77
branch=master

test/logging_test.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <string_view>
2+
13
#include <gmock/gmock.h>
24
#include <gtest/gtest.h>
35

@@ -41,6 +43,15 @@ TEST(log, can_format_extra_params) {
4143
"String=Hello Int=42\n"));
4244
};
4345

46+
TEST(log, accept_string_view_as_extra_param) {
47+
testing::internal::CaptureStderr();
48+
std::string_view str{"world"};
49+
utl::log_info("MyCtx", "Hello {}!", str);
50+
EXPECT_THAT(testing::internal::GetCapturedStderr(),
51+
MatchesRegex(".+T.+Z \\[info\\] \\[logging.+:.+\\] \\[MyCtx\\] "
52+
"Hello world!\n"));
53+
};
54+
4455
TEST(log, can_have_optional_attrs) {
4556
testing::internal::CaptureStderr();
4657
utl::log_info("MyCtx", "Message").attrs({{"key", "value"}});

0 commit comments

Comments
 (0)