37#include "gmock/internal/gmock-internal-utils.h"
42#include "gmock/gmock.h"
43#include "gmock/internal/gmock-port.h"
44#include "gtest/gtest.h"
51GTEST_API_ std::string JoinAsTuple(
const Strings& fields) {
52 switch (fields.size()) {
58 std::string result =
"(" + fields[0];
59 for (
size_t i = 1; i < fields.size(); i++) {
72GTEST_API_ std::string ConvertIdentifierNameToWords(
const char* id_name) {
74 char prev_char =
'\0';
75 for (
const char* p = id_name; *p !=
'\0'; prev_char = *(p++)) {
78 const bool starts_new_word = IsUpper(*p) ||
79 (!IsAlpha(prev_char) && IsLower(*p)) ||
80 (!IsDigit(prev_char) && IsDigit(*p));
83 if (starts_new_word && result !=
"")
85 result += ToLower(*p);
96 void ReportFailure(FailureType type,
const char* file,
int line,
97 const std::string& message)
override {
99 TestPartResult::kFatalFailure :
100 TestPartResult::kNonFatalFailure,
104 if (type == kFatal) {
120 return failure_reporter;
124static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex);
128GTEST_API_
bool LogIsVisible(LogSeverity severity) {
129 if (GMOCK_FLAG(verbose) == kInfoVerbosity) {
132 }
else if (GMOCK_FLAG(verbose) == kErrorVerbosity) {
138 return severity == kWarning;
149GTEST_API_
void Log(LogSeverity severity,
const std::string& message,
150 int stack_frames_to_skip) {
151 if (!LogIsVisible(severity))
155 MutexLock l(&g_log_mutex);
157 if (severity == kWarning) {
159 std::cout <<
"\nGMOCK WARNING:";
162 if (message.empty() || message[0] !=
'\n') {
165 std::cout << message;
166 if (stack_frames_to_skip >= 0) {
169 const int actual_to_skip = 0;
173 const int actual_to_skip = stack_frames_to_skip + 1;
177 if (!message.empty() && *message.rbegin() !=
'\n') {
180 std::cout <<
"Stack trace:\n"
181 << ::testing::internal::GetCurrentOsStackTraceExceptTop(
182 ::testing::UnitTest::GetInstance(), actual_to_skip);
184 std::cout << ::std::flush;
187GTEST_API_ WithoutMatchers GetWithoutMatchers() {
return WithoutMatchers(); }
189GTEST_API_
void IllegalDoDefault(
const char* file,
int line) {
192 "You are using DoDefault() inside a composite action like "
193 "DoAll() or WithArgs(). This is not supported for technical "
194 "reasons. Please instead spell out the default action, or "
195 "assign the default action to an Action variable and use "
196 "the variable in various places.");
Definition gtest-message.h:91
Definition gmock-internal-utils.h:193
Definition gmock-internal-utils.cc:94