MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / PrintOnOneLine

Function PrintOnOneLine

tests/gtest/gtest-all.cc:6974–6990  ·  view source on GitHub ↗

Prints the given C-string on a single line by replacing all '\n' characters with string "\\n". If the output takes more than max_length characters, only prints the first max_length characters and "...".

Source from the content-addressed store, hash-verified

6972// max_length characters, only prints the first max_length characters
6973// and "...".
6974static void PrintOnOneLine(const char* str, int max_length) {
6975 if (str != nullptr) {
6976 for (int i = 0; *str != '\0'; ++str) {
6977 if (i >= max_length) {
6978 printf("...");
6979 break;
6980 }
6981 if (*str == '\n') {
6982 printf("\\n");
6983 i += 2;
6984 } else {
6985 printf("%c", *str);
6986 ++i;
6987 }
6988 }
6989 }
6990}
6991
6992// Prints the names of the tests matching the user-specified filter flag.
6993void UnitTestImpl::ListTestsMatchingFilter() {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected