-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODE_NOLOG: Added support for glog's LOG_STRING()
- Loading branch information
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// Created by acey on 07.09.23. | ||
// | ||
|
||
#include <gtest/gtest.h> | ||
#include <log++.h> | ||
#include <test_utils.h> | ||
|
||
TEST(nolog_log_string, severity_info) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::vector<std::string> errors; | ||
|
||
LOG_STRING(INFO, &errors) << "LOG_STRING: " | ||
<< "collected info"; | ||
ASSERT_TRUE(errors.empty()); | ||
} | ||
|
||
TEST(nolog_log_string, severity_info_null) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::string output = | ||
LPP_CAPTURE_STDOUT(LOG_STRING(INFO, nullptr) << "LOG_STRING: " | ||
<< "collected info"); | ||
ASSERT_EQ(output, ""); | ||
} | ||
|
||
TEST(nolog_log_string, severity_warning) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::vector<std::string> errors; | ||
|
||
LOG_STRING(WARNING, &errors) << "LOG_STRING: " | ||
<< "collected warn"; | ||
ASSERT_TRUE(errors.empty()); | ||
} | ||
|
||
TEST(nolog_log_string, severity_warning_null) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::string output = | ||
LPP_CAPTURE_STDOUT(LOG_STRING(WARNING, nullptr) << "LOG_STRING: " | ||
<< "collected warn"); | ||
ASSERT_EQ(output, ""); | ||
} | ||
|
||
TEST(nolog_log_string, severity_error) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::vector<std::string> errors; | ||
|
||
LOG_STRING(ERROR, &errors) << "LOG_STRING: " | ||
<< "collected error"; | ||
ASSERT_TRUE(errors.empty()); | ||
} | ||
|
||
TEST(nolog_log_string, severity_error_null) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::string output = | ||
LPP_CAPTURE_STDOUT(LOG_STRING(ERROR, nullptr) << "LOG_STRING: " | ||
<< "collected error"); | ||
ASSERT_EQ(output, ""); | ||
} | ||
|
||
TEST(nolog_log_string, severity_fatal) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::vector<std::string> errors; | ||
|
||
LOG_STRING(ERROR, &errors) << "LOG_STRING: " | ||
<< "collected error"; | ||
ASSERT_TRUE(errors.empty()); | ||
} | ||
|
||
TEST(nolog_log_string, severity_fatal_null) { | ||
LOG_INIT(*test_argv); | ||
|
||
std::string output = | ||
LPP_CAPTURE_STDOUT(LOG_STRING(FATAL, nullptr) << "LOG_STRING: " | ||
<< "collected fatal"); | ||
ASSERT_EQ(output, ""); | ||
} |