mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-24 06:27:56 +00:00
Merge gtest-1.3.0.
OSX users: make sure that CrashReporter is disabled when running unit tests. Death tests are enabled now so you'll get a ton of message boxes. llvm-svn: 105352
This commit is contained in:
parent
f3bd81ce11
commit
82e5e91f69
File diff suppressed because it is too large
Load Diff
@ -36,21 +36,22 @@
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h>
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
#elif GTEST_OS_WINDOWS
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#elif defined(GTEST_OS_SYMBIAN)
|
||||
#elif GTEST_OS_SYMBIAN
|
||||
// Symbian OpenC has PATH_MAX in sys/syslimits.h
|
||||
#include <sys/syslimits.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h> // NOLINT
|
||||
#include <unistd.h> // NOLINT
|
||||
#include <climits> // Some Linux distributions define PATH_MAX here.
|
||||
#endif // _WIN32_WCE or _WIN32
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#define GTEST_PATH_MAX_ _MAX_PATH
|
||||
#elif defined(PATH_MAX)
|
||||
#define GTEST_PATH_MAX_ PATH_MAX
|
||||
@ -65,7 +66,7 @@
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
const char kPathSeparator = '\\';
|
||||
const char kPathSeparatorString[] = "\\";
|
||||
#ifdef _WIN32_WCE
|
||||
@ -90,7 +91,7 @@ FilePath FilePath::GetCurrentDir() {
|
||||
// Windows CE doesn't have a current directory, so we just return
|
||||
// something reasonable.
|
||||
return FilePath(kCurrentDirectoryString);
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
#elif GTEST_OS_WINDOWS
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = {};
|
||||
return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
|
||||
#else
|
||||
@ -144,19 +145,28 @@ FilePath FilePath::MakeFileName(const FilePath& directory,
|
||||
const FilePath& base_name,
|
||||
int number,
|
||||
const char* extension) {
|
||||
FilePath dir(directory.RemoveTrailingPathSeparator());
|
||||
if (number == 0) {
|
||||
return FilePath(String::Format("%s%c%s.%s", dir.c_str(), kPathSeparator,
|
||||
base_name.c_str(), extension));
|
||||
}
|
||||
return FilePath(String::Format("%s%c%s_%d.%s", dir.c_str(), kPathSeparator,
|
||||
base_name.c_str(), number, extension));
|
||||
const FilePath file_name(
|
||||
(number == 0) ?
|
||||
String::Format("%s.%s", base_name.c_str(), extension) :
|
||||
String::Format("%s_%d.%s", base_name.c_str(), number, extension));
|
||||
return ConcatPaths(directory, file_name);
|
||||
}
|
||||
|
||||
// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
|
||||
// On Windows, uses \ as the separator rather than /.
|
||||
FilePath FilePath::ConcatPaths(const FilePath& directory,
|
||||
const FilePath& relative_path) {
|
||||
if (directory.IsEmpty())
|
||||
return relative_path;
|
||||
const FilePath dir(directory.RemoveTrailingPathSeparator());
|
||||
return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
|
||||
relative_path.c_str()));
|
||||
}
|
||||
|
||||
// Returns true if pathname describes something findable in the file-system,
|
||||
// either a file, directory, or whatever.
|
||||
bool FilePath::FileOrDirectoryExists() const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef _WIN32_WCE
|
||||
LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
|
||||
const DWORD attributes = GetFileAttributes(unicode);
|
||||
@ -176,7 +186,7 @@ bool FilePath::FileOrDirectoryExists() const {
|
||||
// that exists.
|
||||
bool FilePath::DirectoryExists() const {
|
||||
bool result = false;
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Don't strip off trailing separator if path is a root directory on
|
||||
// Windows (like "C:\\").
|
||||
const FilePath& path(IsRootDirectory() ? *this :
|
||||
@ -205,15 +215,27 @@ bool FilePath::DirectoryExists() const {
|
||||
// Returns true if pathname describes a root directory. (Windows has one
|
||||
// root directory per disk drive.)
|
||||
bool FilePath::IsRootDirectory() const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// TODO(wan@google.com): on Windows a network share like
|
||||
// \\server\share can be a root directory, although it cannot be the
|
||||
// current directory. Handle this properly.
|
||||
return pathname_.GetLength() == 3 && IsAbsolutePath();
|
||||
#else
|
||||
return pathname_ == kPathSeparatorString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns true if pathname describes an absolute path.
|
||||
bool FilePath::IsAbsolutePath() const {
|
||||
const char* const name = pathname_.c_str();
|
||||
return pathname_.GetLength() == 3 &&
|
||||
#if GTEST_OS_WINDOWS
|
||||
return pathname_.GetLength() >= 3 &&
|
||||
((name[0] >= 'a' && name[0] <= 'z') ||
|
||||
(name[0] >= 'A' && name[0] <= 'Z')) &&
|
||||
name[1] == ':' &&
|
||||
name[2] == kPathSeparator;
|
||||
#else
|
||||
return pathname_ == kPathSeparatorString;
|
||||
return name[0] == kPathSeparator;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -264,7 +286,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
|
||||
// directory for any reason, including if the parent directory does not
|
||||
// exist. Not named "CreateDirectory" because that's a macro on Windows.
|
||||
bool FilePath::CreateFolder() const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef _WIN32_WCE
|
||||
FilePath removed_sep(this->RemoveTrailingPathSeparator());
|
||||
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
|
||||
|
@ -35,9 +35,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#include <regex.h>
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_OS_WINDOWS
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_USES_SIMPLE_RE
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h> // For TerminateProcess()
|
||||
@ -47,11 +54,26 @@
|
||||
#include <gtest/gtest-message.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
// Indicates that this translation unit is part of Google Test's
|
||||
// implementation. It must come before gtest-internal-inl.h is
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "gtest/internal/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Microsoft does not provide a definition of STDERR_FILENO.
|
||||
const int kStdErrFileno = 2;
|
||||
#else
|
||||
const int kStdErrFileno = STDERR_FILENO;
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_USES_POSIX_RE
|
||||
|
||||
// Implements RE. Currently only needed for death tests.
|
||||
|
||||
@ -93,7 +115,13 @@ void RE::Init(const char* regex) {
|
||||
// previous expression returns false. Otherwise partial_regex_ may
|
||||
// not be properly initialized can may cause trouble when it's
|
||||
// freed.
|
||||
is_valid_ = (regcomp(&partial_regex_, regex, REG_EXTENDED) == 0) && is_valid_;
|
||||
//
|
||||
// Some implementation of POSIX regex (e.g. on at least some
|
||||
// versions of Cygwin) doesn't accept the empty string as a valid
|
||||
// regex. We change it to an equivalent form "()" to be safe.
|
||||
const char* const partial_regex = (*regex == '\0') ? "()" : regex;
|
||||
is_valid_ = (regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0)
|
||||
&& is_valid_;
|
||||
EXPECT_TRUE(is_valid_)
|
||||
<< "Regular expression \"" << regex
|
||||
<< "\" is not a valid POSIX Extended regular expression.";
|
||||
@ -101,7 +129,262 @@ void RE::Init(const char* regex) {
|
||||
delete[] full_pattern;
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
#elif GTEST_USES_SIMPLE_RE
|
||||
|
||||
// Returns true iff ch appears anywhere in str (excluding the
|
||||
// terminating '\0' character).
|
||||
bool IsInSet(char ch, const char* str) {
|
||||
return ch != '\0' && strchr(str, ch) != NULL;
|
||||
}
|
||||
|
||||
// Returns true iff ch belongs to the given classification. Unlike
|
||||
// similar functions in <ctype.h>, these aren't affected by the
|
||||
// current locale.
|
||||
bool IsDigit(char ch) { return '0' <= ch && ch <= '9'; }
|
||||
bool IsPunct(char ch) {
|
||||
return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
|
||||
}
|
||||
bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
|
||||
bool IsWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
|
||||
bool IsWordChar(char ch) {
|
||||
return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
|
||||
('0' <= ch && ch <= '9') || ch == '_';
|
||||
}
|
||||
|
||||
// Returns true iff "\\c" is a supported escape sequence.
|
||||
bool IsValidEscape(char c) {
|
||||
return (IsPunct(c) || IsInSet(c, "dDfnrsStvwW"));
|
||||
}
|
||||
|
||||
// Returns true iff the given atom (specified by escaped and pattern)
|
||||
// matches ch. The result is undefined if the atom is invalid.
|
||||
bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
|
||||
if (escaped) { // "\\p" where p is pattern_char.
|
||||
switch (pattern_char) {
|
||||
case 'd': return IsDigit(ch);
|
||||
case 'D': return !IsDigit(ch);
|
||||
case 'f': return ch == '\f';
|
||||
case 'n': return ch == '\n';
|
||||
case 'r': return ch == '\r';
|
||||
case 's': return IsWhiteSpace(ch);
|
||||
case 'S': return !IsWhiteSpace(ch);
|
||||
case 't': return ch == '\t';
|
||||
case 'v': return ch == '\v';
|
||||
case 'w': return IsWordChar(ch);
|
||||
case 'W': return !IsWordChar(ch);
|
||||
}
|
||||
return IsPunct(pattern_char) && pattern_char == ch;
|
||||
}
|
||||
|
||||
return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
|
||||
}
|
||||
|
||||
// Helper function used by ValidateRegex() to format error messages.
|
||||
String FormatRegexSyntaxError(const char* regex, int index) {
|
||||
return (Message() << "Syntax error at index " << index
|
||||
<< " in simple regular expression \"" << regex << "\": ").GetString();
|
||||
}
|
||||
|
||||
// Generates non-fatal failures and returns false if regex is invalid;
|
||||
// otherwise returns true.
|
||||
bool ValidateRegex(const char* regex) {
|
||||
if (regex == NULL) {
|
||||
// TODO(wan@google.com): fix the source file location in the
|
||||
// assertion failures to match where the regex is used in user
|
||||
// code.
|
||||
ADD_FAILURE() << "NULL is not a valid simple regular expression.";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_valid = true;
|
||||
|
||||
// True iff ?, *, or + can follow the previous atom.
|
||||
bool prev_repeatable = false;
|
||||
for (int i = 0; regex[i]; i++) {
|
||||
if (regex[i] == '\\') { // An escape sequence
|
||||
i++;
|
||||
if (regex[i] == '\0') {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
|
||||
<< "'\\' cannot appear at the end.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidEscape(regex[i])) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
|
||||
<< "invalid escape sequence \"\\" << regex[i] << "\".";
|
||||
is_valid = false;
|
||||
}
|
||||
prev_repeatable = true;
|
||||
} else { // Not an escape sequence.
|
||||
const char ch = regex[i];
|
||||
|
||||
if (ch == '^' && i > 0) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'^' can only appear at the beginning.";
|
||||
is_valid = false;
|
||||
} else if (ch == '$' && regex[i + 1] != '\0') {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'$' can only appear at the end.";
|
||||
is_valid = false;
|
||||
} else if (IsInSet(ch, "()[]{}|")) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'" << ch << "' is unsupported.";
|
||||
is_valid = false;
|
||||
} else if (IsRepeat(ch) && !prev_repeatable) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'" << ch << "' can only follow a repeatable token.";
|
||||
is_valid = false;
|
||||
}
|
||||
|
||||
prev_repeatable = !IsInSet(ch, "^$?*+");
|
||||
}
|
||||
}
|
||||
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
// Matches a repeated regex atom followed by a valid simple regular
|
||||
// expression. The regex atom is defined as c if escaped is false,
|
||||
// or \c otherwise. repeat is the repetition meta character (?, *,
|
||||
// or +). The behavior is undefined if str contains too many
|
||||
// characters to be indexable by size_t, in which case the test will
|
||||
// probably time out anyway. We are fine with this limitation as
|
||||
// std::string has it too.
|
||||
bool MatchRepetitionAndRegexAtHead(
|
||||
bool escaped, char c, char repeat, const char* regex,
|
||||
const char* str) {
|
||||
const size_t min_count = (repeat == '+') ? 1 : 0;
|
||||
const size_t max_count = (repeat == '?') ? 1 :
|
||||
static_cast<size_t>(-1) - 1;
|
||||
// We cannot call numeric_limits::max() as it conflicts with the
|
||||
// max() macro on Windows.
|
||||
|
||||
for (size_t i = 0; i <= max_count; ++i) {
|
||||
// We know that the atom matches each of the first i characters in str.
|
||||
if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
|
||||
// We have enough matches at the head, and the tail matches too.
|
||||
// Since we only care about *whether* the pattern matches str
|
||||
// (as opposed to *how* it matches), there is no need to find a
|
||||
// greedy match.
|
||||
return true;
|
||||
}
|
||||
if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true iff regex matches a prefix of str. regex must be a
|
||||
// valid simple regular expression and not start with "^", or the
|
||||
// result is undefined.
|
||||
bool MatchRegexAtHead(const char* regex, const char* str) {
|
||||
if (*regex == '\0') // An empty regex matches a prefix of anything.
|
||||
return true;
|
||||
|
||||
// "$" only matches the end of a string. Note that regex being
|
||||
// valid guarantees that there's nothing after "$" in it.
|
||||
if (*regex == '$')
|
||||
return *str == '\0';
|
||||
|
||||
// Is the first thing in regex an escape sequence?
|
||||
const bool escaped = *regex == '\\';
|
||||
if (escaped)
|
||||
++regex;
|
||||
if (IsRepeat(regex[1])) {
|
||||
// MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
|
||||
// here's an indirect recursion. It terminates as the regex gets
|
||||
// shorter in each recursion.
|
||||
return MatchRepetitionAndRegexAtHead(
|
||||
escaped, regex[0], regex[1], regex + 2, str);
|
||||
} else {
|
||||
// regex isn't empty, isn't "$", and doesn't start with a
|
||||
// repetition. We match the first atom of regex with the first
|
||||
// character of str and recurse.
|
||||
return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
|
||||
MatchRegexAtHead(regex + 1, str + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true iff regex matches any substring of str. regex must be
|
||||
// a valid simple regular expression, or the result is undefined.
|
||||
//
|
||||
// The algorithm is recursive, but the recursion depth doesn't exceed
|
||||
// the regex length, so we won't need to worry about running out of
|
||||
// stack space normally. In rare cases the time complexity can be
|
||||
// exponential with respect to the regex length + the string length,
|
||||
// but usually it's must faster (often close to linear).
|
||||
bool MatchRegexAnywhere(const char* regex, const char* str) {
|
||||
if (regex == NULL || str == NULL)
|
||||
return false;
|
||||
|
||||
if (*regex == '^')
|
||||
return MatchRegexAtHead(regex + 1, str);
|
||||
|
||||
// A successful match can be anywhere in str.
|
||||
do {
|
||||
if (MatchRegexAtHead(regex, str))
|
||||
return true;
|
||||
} while (*str++ != '\0');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Implements the RE class.
|
||||
|
||||
RE::~RE() {
|
||||
free(const_cast<char*>(pattern_));
|
||||
free(const_cast<char*>(full_pattern_));
|
||||
}
|
||||
|
||||
// Returns true iff regular expression re matches the entire str.
|
||||
bool RE::FullMatch(const char* str, const RE& re) {
|
||||
return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
|
||||
}
|
||||
|
||||
// Returns true iff regular expression re matches a substring of str
|
||||
// (including str itself).
|
||||
bool RE::PartialMatch(const char* str, const RE& re) {
|
||||
return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
|
||||
}
|
||||
|
||||
// Initializes an RE from its string representation.
|
||||
void RE::Init(const char* regex) {
|
||||
pattern_ = full_pattern_ = NULL;
|
||||
if (regex != NULL) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
pattern_ = _strdup(regex);
|
||||
#else
|
||||
pattern_ = strdup(regex);
|
||||
#endif
|
||||
}
|
||||
|
||||
is_valid_ = ValidateRegex(regex);
|
||||
if (!is_valid_) {
|
||||
// No need to calculate the full pattern when the regex is invalid.
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t len = strlen(regex);
|
||||
// Reserves enough bytes to hold the regular expression used for a
|
||||
// full match: we need space to prepend a '^', append a '$', and
|
||||
// terminate the string with '\0'.
|
||||
char* buffer = static_cast<char*>(malloc(len + 3));
|
||||
full_pattern_ = buffer;
|
||||
|
||||
if (*regex != '^')
|
||||
*buffer++ = '^'; // Makes sure full_pattern_ starts with '^'.
|
||||
|
||||
// We don't use snprintf or strncpy, as they trigger a warning when
|
||||
// compiled with VC++ 8.0.
|
||||
memcpy(buffer, regex, len);
|
||||
buffer += len;
|
||||
|
||||
if (len == 0 || regex[len - 1] != '$')
|
||||
*buffer++ = '$'; // Makes sure full_pattern_ ends with '$'.
|
||||
|
||||
*buffer = '\0';
|
||||
}
|
||||
|
||||
#endif // GTEST_USES_POSIX_RE
|
||||
|
||||
// Logs a message at the given severity level.
|
||||
void GTestLog(GTestLogSeverity severity, const char* file,
|
||||
@ -112,11 +395,19 @@ void GTestLog(GTestLogSeverity severity, const char* file,
|
||||
severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
|
||||
fprintf(stderr, "\n%s %s:%d: %s\n", marker, file, line, msg);
|
||||
if (severity == GTEST_FATAL) {
|
||||
fflush(NULL); // abort() is not guaranteed to flush open file streams.
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_STD_STRING
|
||||
|
||||
// Disable Microsoft deprecation warnings for POSIX functions called from
|
||||
// this class (creat, dup, dup2, and close)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Defines the stderr capturer.
|
||||
|
||||
@ -124,16 +415,26 @@ class CapturedStderr {
|
||||
public:
|
||||
// The ctor redirects stderr to a temporary file.
|
||||
CapturedStderr() {
|
||||
uncaptured_fd_ = dup(STDERR_FILENO);
|
||||
uncaptured_fd_ = dup(kStdErrFileno);
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||
char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||
|
||||
::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
|
||||
::GetTempFileNameA(temp_dir_path, "gtest_redir", 0, temp_file_path);
|
||||
const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
|
||||
filename_ = temp_file_path;
|
||||
#else
|
||||
// There's no guarantee that a test has write access to the
|
||||
// current directory, so we create the temporary file in the /tmp
|
||||
// directory instead.
|
||||
char name_template[] = "/tmp/captured_stderr.XXXXXX";
|
||||
const int captured_fd = mkstemp(name_template);
|
||||
filename_ = name_template;
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
fflush(NULL);
|
||||
dup2(captured_fd, STDERR_FILENO);
|
||||
dup2(captured_fd, kStdErrFileno);
|
||||
close(captured_fd);
|
||||
}
|
||||
|
||||
@ -145,7 +446,7 @@ class CapturedStderr {
|
||||
void StopCapture() {
|
||||
// Restores the original stream.
|
||||
fflush(NULL);
|
||||
dup2(uncaptured_fd_, STDERR_FILENO);
|
||||
dup2(uncaptured_fd_, kStdErrFileno);
|
||||
close(uncaptured_fd_);
|
||||
uncaptured_fd_ = -1;
|
||||
}
|
||||
@ -160,6 +461,10 @@ class CapturedStderr {
|
||||
::std::string filename_;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
static CapturedStderr* g_captured_stderr = NULL;
|
||||
|
||||
// Returns the size (in bytes) of a file.
|
||||
@ -169,8 +474,6 @@ static size_t GetFileSize(FILE * file) {
|
||||
}
|
||||
|
||||
// Reads the entire content of a file as a string.
|
||||
// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can
|
||||
// use it here.
|
||||
static ::std::string ReadEntireFile(FILE * file) {
|
||||
const size_t file_size = GetFileSize(file);
|
||||
char* const buffer = new char[file_size];
|
||||
@ -206,9 +509,18 @@ void CaptureStderr() {
|
||||
// use it here.
|
||||
::std::string GetCapturedStderr() {
|
||||
g_captured_stderr->StopCapture();
|
||||
|
||||
// Disables Microsoft deprecation warning for fopen and fclose.
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif // _MSC_VER
|
||||
FILE* const file = fopen(g_captured_stderr->filename().c_str(), "r");
|
||||
const ::std::string content = ReadEntireFile(file);
|
||||
fclose(file);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
delete g_captured_stderr;
|
||||
g_captured_stderr = NULL;
|
||||
@ -216,6 +528,10 @@ void CaptureStderr() {
|
||||
return content;
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
||||
::std::vector<String> g_argvs;
|
||||
|
||||
@ -235,7 +551,8 @@ void abort() {
|
||||
// given flag. For example, FlagToEnvVar("foo") will return
|
||||
// "GTEST_FOO" in the open-source version.
|
||||
static String FlagToEnvVar(const char* flag) {
|
||||
const String full_flag = (Message() << GTEST_FLAG_PREFIX << flag).GetString();
|
||||
const String full_flag =
|
||||
(Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
|
||||
|
||||
Message env_var;
|
||||
for (int i = 0; i != full_flag.GetLength(); i++) {
|
||||
@ -245,17 +562,6 @@ static String FlagToEnvVar(const char* flag) {
|
||||
return env_var.GetString();
|
||||
}
|
||||
|
||||
// Reads and returns the Boolean environment variable corresponding to
|
||||
// the given flag; if it's not set, returns default_value.
|
||||
//
|
||||
// The value is considered true iff it's not "0".
|
||||
bool BoolFromGTestEnv(const char* flag, bool default_value) {
|
||||
const String env_var = FlagToEnvVar(flag);
|
||||
const char* const string_value = GetEnv(env_var.c_str());
|
||||
return string_value == NULL ?
|
||||
default_value : strcmp(string_value, "0") != 0;
|
||||
}
|
||||
|
||||
// Parses 'str' for a 32-bit signed integer. If successful, writes
|
||||
// the result to *value and returns true; otherwise leaves *value
|
||||
// unchanged and returns false.
|
||||
@ -297,6 +603,17 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reads and returns the Boolean environment variable corresponding to
|
||||
// the given flag; if it's not set, returns default_value.
|
||||
//
|
||||
// The value is considered true iff it's not "0".
|
||||
bool BoolFromGTestEnv(const char* flag, bool default_value) {
|
||||
const String env_var = FlagToEnvVar(flag);
|
||||
const char* const string_value = GetEnv(env_var.c_str());
|
||||
return string_value == NULL ?
|
||||
default_value : strcmp(string_value, "0") != 0;
|
||||
}
|
||||
|
||||
// Reads and returns a 32-bit integer stored in the environment
|
||||
// variable corresponding to the given flag; if it isn't set or
|
||||
// doesn't represent a valid 32-bit integer, returns default_value.
|
||||
|
@ -38,9 +38,9 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "gtest/internal/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// Verifies that registered_tests match the test names in
|
||||
// defined_test_names_; returns registered_tests if successful, or
|
||||
@ -85,6 +85,7 @@ const char* TypedTestCasePState::VerifyRegisteredTestNames(
|
||||
if (errors_str != "") {
|
||||
fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
|
||||
errors_str.c_str());
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -49,7 +49,7 @@ namespace testing {
|
||||
// after forking.
|
||||
GTEST_DECLARE_string_(death_test_style);
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// The following macros are useful for writing death tests.
|
||||
|
||||
@ -86,6 +86,57 @@ GTEST_DECLARE_string_(death_test_style);
|
||||
//
|
||||
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
|
||||
//
|
||||
// On the regular expressions used in death tests:
|
||||
//
|
||||
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
||||
// which uses the POSIX extended regex syntax.
|
||||
//
|
||||
// On other platforms (e.g. Windows), we only support a simple regex
|
||||
// syntax implemented as part of Google Test. This limited
|
||||
// implementation should be enough most of the time when writing
|
||||
// death tests; though it lacks many features you can find in PCRE
|
||||
// or POSIX extended regex syntax. For example, we don't support
|
||||
// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
|
||||
// repetition count ("x{5,7}"), among others.
|
||||
//
|
||||
// Below is the syntax that we do support. We chose it to be a
|
||||
// subset of both PCRE and POSIX extended regex, so it's easy to
|
||||
// learn wherever you come from. In the following: 'A' denotes a
|
||||
// literal character, period (.), or a single \\ escape sequence;
|
||||
// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
|
||||
// natural numbers.
|
||||
//
|
||||
// c matches any literal character c
|
||||
// \\d matches any decimal digit
|
||||
// \\D matches any character that's not a decimal digit
|
||||
// \\f matches \f
|
||||
// \\n matches \n
|
||||
// \\r matches \r
|
||||
// \\s matches any ASCII whitespace, including \n
|
||||
// \\S matches any character that's not a whitespace
|
||||
// \\t matches \t
|
||||
// \\v matches \v
|
||||
// \\w matches any letter, _, or decimal digit
|
||||
// \\W matches any character that \\w doesn't match
|
||||
// \\c matches any literal character c, which must be a punctuation
|
||||
// . matches any single character except \n
|
||||
// A? matches 0 or 1 occurrences of A
|
||||
// A* matches 0 or many occurrences of A
|
||||
// A+ matches 1 or many occurrences of A
|
||||
// ^ matches the beginning of a string (not that of each line)
|
||||
// $ matches the end of a string (not that of each line)
|
||||
// xy matches x followed by y
|
||||
//
|
||||
// If you accidentally use PCRE or POSIX extended regex features
|
||||
// not implemented by us, you will get a run-time failure. In that
|
||||
// case, please try to rewrite your regular expression within the
|
||||
// above syntax.
|
||||
//
|
||||
// This implementation is *not* meant to be as highly tuned or robust
|
||||
// as a compiled regex library, but should perform well enough for a
|
||||
// death test, which already incurs significant overhead by launching
|
||||
// a child process.
|
||||
//
|
||||
// Known caveats:
|
||||
//
|
||||
// A "threadsafe" style death test obtains the path to the test
|
||||
@ -133,6 +184,7 @@ class ExitedWithCode {
|
||||
const int exit_code_;
|
||||
};
|
||||
|
||||
#if !GTEST_OS_WINDOWS
|
||||
// Tests that an exit code describes an exit due to termination by a
|
||||
// given signal.
|
||||
class KilledBySignal {
|
||||
@ -142,6 +194,7 @@ class KilledBySignal {
|
||||
private:
|
||||
const int signum_;
|
||||
};
|
||||
#endif // !GTEST_OS_WINDOWS
|
||||
|
||||
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
||||
// The death testing framework causes this to have interesting semantics,
|
||||
|
@ -102,7 +102,7 @@ class Message {
|
||||
}
|
||||
|
||||
~Message() { delete ss_; }
|
||||
#ifdef GTEST_OS_SYMBIAN
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// Streams a value (either a pointer or not) to this object.
|
||||
template <typename T>
|
||||
inline Message& operator <<(const T& value) {
|
||||
@ -187,7 +187,7 @@ class Message {
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef GTEST_OS_SYMBIAN
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||
// decide between class template specializations for T and T*, so a
|
||||
|
@ -151,7 +151,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
@ -1190,7 +1190,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
||||
return Values(false, true);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// Combine() allows the user to combine two or more sequences to produce
|
||||
// values of a Cartesian product of those sequences' elements.
|
||||
//
|
||||
|
@ -151,7 +151,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||
|
||||
// Implements typed tests.
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
@ -186,7 +186,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||
|
||||
// Implements type-parameterized tests.
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
|
@ -93,16 +93,58 @@
|
||||
|
||||
namespace testing {
|
||||
|
||||
// The upper limit for valid stack trace depths.
|
||||
const int kMaxStackTraceDepth = 100;
|
||||
// Declares the flags.
|
||||
|
||||
// This flag temporary enables the disabled tests.
|
||||
GTEST_DECLARE_bool_(also_run_disabled_tests);
|
||||
|
||||
// This flag brings the debugger on an assertion failure.
|
||||
GTEST_DECLARE_bool_(break_on_failure);
|
||||
|
||||
// This flag controls whether Google Test catches all test-thrown exceptions
|
||||
// and logs them as failures.
|
||||
GTEST_DECLARE_bool_(catch_exceptions);
|
||||
|
||||
// This flag enables using colors in terminal output. Available values are
|
||||
// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
|
||||
// to let Google Test decide.
|
||||
GTEST_DECLARE_string_(color);
|
||||
|
||||
// This flag sets up the filter to select by name using a glob pattern
|
||||
// the tests to run. If the filter is not given all tests are executed.
|
||||
GTEST_DECLARE_string_(filter);
|
||||
|
||||
// This flag causes the Google Test to list tests. None of the tests listed
|
||||
// are actually run if the flag is provided.
|
||||
GTEST_DECLARE_bool_(list_tests);
|
||||
|
||||
// This flag controls whether Google Test emits a detailed XML report to a file
|
||||
// in addition to its normal textual output.
|
||||
GTEST_DECLARE_string_(output);
|
||||
|
||||
// This flags control whether Google Test prints the elapsed time for each
|
||||
// test.
|
||||
GTEST_DECLARE_bool_(print_time);
|
||||
|
||||
// This flag sets how many times the tests are repeated. The default value
|
||||
// is 1. If the value is -1 the tests are repeating forever.
|
||||
GTEST_DECLARE_int32_(repeat);
|
||||
|
||||
// This flag controls whether Google Test includes Google Test internal
|
||||
// stack frames in failure stack traces.
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
|
||||
// This flag specifies the maximum number of stack frames to be
|
||||
// printed in a failure message.
|
||||
GTEST_DECLARE_int32_(stack_trace_depth);
|
||||
|
||||
// This flag controls whether Google Test includes Google Test internal
|
||||
// stack frames in failure stack traces.
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
// When this flag is specified, a failed assertion will throw an
|
||||
// exception if exceptions are enabled, or exit the program with a
|
||||
// non-zero code otherwise.
|
||||
GTEST_DECLARE_bool_(throw_on_failure);
|
||||
|
||||
// The upper limit for valid stack trace depths.
|
||||
const int kMaxStackTraceDepth = 100;
|
||||
|
||||
namespace internal {
|
||||
|
||||
@ -353,7 +395,7 @@ class TestInfo {
|
||||
// Returns the result of the test.
|
||||
const internal::TestResult* result() const;
|
||||
private:
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
friend class internal::DefaultDeathTestFactory;
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
friend class internal::TestInfoImpl;
|
||||
@ -484,7 +526,7 @@ class UnitTest {
|
||||
// or NULL if no test is running.
|
||||
const TestInfo* current_test_info() const;
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Returns the ParameterizedTestCaseRegistry object used to keep track of
|
||||
// value-parameterized tests and instantiate and register them.
|
||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
|
||||
@ -614,10 +656,20 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
|
||||
const char* actual_expression,
|
||||
const T1& expected,
|
||||
const T2& actual) {
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
#pragma warning(disable:4389) // Temporarily disables warning on
|
||||
// signed/unsigned mismatch.
|
||||
#endif
|
||||
|
||||
if (expected == actual) {
|
||||
return AssertionSuccess();
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop) // Restores the warning state.
|
||||
#endif
|
||||
|
||||
return EqFailure(expected_expression,
|
||||
actual_expression,
|
||||
FormatForComparisonFailureMessage(expected, actual),
|
||||
@ -688,7 +740,7 @@ class EqHelper<true> {
|
||||
template <typename T1, typename T2>
|
||||
static AssertionResult Compare(const char* expected_expression,
|
||||
const char* actual_expression,
|
||||
const T1& expected,
|
||||
const T1& /* expected */,
|
||||
T2* actual) {
|
||||
// We already know that 'expected' is a null pointer.
|
||||
return CmpHelperEQ(expected_expression, actual_expression,
|
||||
@ -893,7 +945,7 @@ class AssertHelper {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// The abstract base class that all value-parameterized tests inherit from.
|
||||
//
|
||||
// This class adds support for accessing the test parameter value via
|
||||
@ -1187,7 +1239,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
double val1, double val2);
|
||||
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Macros that test for HRESULT failure and success, these are only useful
|
||||
// on Windows, and rely on Windows SDK macros and APIs to compile.
|
||||
@ -1242,6 +1294,52 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
||||
__FILE__, __LINE__, ::testing::Message() << (message))
|
||||
|
||||
namespace internal {
|
||||
|
||||
// This template is declared, but intentionally undefined.
|
||||
template <typename T1, typename T2>
|
||||
struct StaticAssertTypeEqHelper;
|
||||
|
||||
template <typename T>
|
||||
struct StaticAssertTypeEqHelper<T, T> {};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Compile-time assertion for type equality.
|
||||
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
|
||||
// the same type. The value it returns is not interesting.
|
||||
//
|
||||
// Instead of making StaticAssertTypeEq a class template, we make it a
|
||||
// function template that invokes a helper class template. This
|
||||
// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
|
||||
// defining objects of that type.
|
||||
//
|
||||
// CAVEAT:
|
||||
//
|
||||
// When used inside a method of a class template,
|
||||
// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
|
||||
// instantiated. For example, given:
|
||||
//
|
||||
// template <typename T> class Foo {
|
||||
// public:
|
||||
// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
|
||||
// };
|
||||
//
|
||||
// the code:
|
||||
//
|
||||
// void Test1() { Foo<bool> foo; }
|
||||
//
|
||||
// will NOT generate a compiler error, as Foo<bool>::Bar() is never
|
||||
// actually instantiated. Instead, you need:
|
||||
//
|
||||
// void Test2() { Foo<bool> foo; foo.Bar(); }
|
||||
//
|
||||
// to cause a compiler error.
|
||||
template <typename T1, typename T2>
|
||||
bool StaticAssertTypeEq() {
|
||||
internal::StaticAssertTypeEqHelper<T1, T2>();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Defines a test.
|
||||
//
|
||||
@ -1269,7 +1367,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
// value, as it always calls GetTypeId<>() from the Google Test
|
||||
// framework.
|
||||
#define TEST(test_case_name, test_name)\
|
||||
GTEST_TEST_(test_case_name, test_name,\
|
||||
GTEST_TEST_(test_case_name, test_name, \
|
||||
::testing::Test, ::testing::internal::GetTestTypeId())
|
||||
|
||||
|
||||
@ -1300,7 +1398,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
// }
|
||||
|
||||
#define TEST_F(test_fixture, test_name)\
|
||||
GTEST_TEST_(test_fixture, test_name, test_fixture,\
|
||||
GTEST_TEST_(test_fixture, test_name, test_fixture, \
|
||||
::testing::internal::GetTypeId<test_fixture>())
|
||||
|
||||
// Use this macro in main() to run all tests. It returns 0 if all
|
||||
|
@ -39,6 +39,10 @@
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST && GTEST_OS_WINDOWS
|
||||
#include <io.h>
|
||||
#endif // GTEST_HAS_DEATH_TEST && GTEST_OS_WINDOWS
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
@ -46,9 +50,10 @@ GTEST_DECLARE_string_(internal_run_death_test);
|
||||
|
||||
// Names of the flags (needed for parsing Google Test flags).
|
||||
const char kDeathTestStyleFlag[] = "death_test_style";
|
||||
const char kDeathTestUseFork[] = "death_test_use_fork";
|
||||
const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// DeathTest is a class that hides much of the complexity of the
|
||||
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
|
||||
@ -120,7 +125,12 @@ class DeathTest {
|
||||
// the last death test.
|
||||
static const char* LastMessage();
|
||||
|
||||
static void set_last_death_test_message(const String& message);
|
||||
|
||||
private:
|
||||
// A string containing a description of the outcome of the last death test.
|
||||
static String last_death_test_message_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
|
||||
};
|
||||
|
||||
@ -166,7 +176,7 @@ bool ExitedUnsuccessfully(int exit_status);
|
||||
case ::testing::internal::DeathTest::EXECUTE_TEST: { \
|
||||
::testing::internal::DeathTest::ReturnSentinel \
|
||||
gtest_sentinel(gtest_dt); \
|
||||
{ statement; } \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
||||
break; \
|
||||
} \
|
||||
@ -178,14 +188,42 @@ bool ExitedUnsuccessfully(int exit_status);
|
||||
// The symbol "fail" here expands to something into which a message
|
||||
// can be streamed.
|
||||
|
||||
// A struct representing the parsed contents of the
|
||||
// A class representing the parsed contents of the
|
||||
// --gtest_internal_run_death_test flag, as it existed when
|
||||
// RUN_ALL_TESTS was called.
|
||||
struct InternalRunDeathTestFlag {
|
||||
String file;
|
||||
int line;
|
||||
int index;
|
||||
int status_fd;
|
||||
class InternalRunDeathTestFlag {
|
||||
public:
|
||||
InternalRunDeathTestFlag(const String& file,
|
||||
int line,
|
||||
int index,
|
||||
int status_fd)
|
||||
: file_(file), line_(line), index_(index), status_fd_(status_fd) {}
|
||||
|
||||
~InternalRunDeathTestFlag() {
|
||||
if (status_fd_ >= 0)
|
||||
// Suppress MSVC complaints about POSIX functions.
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif // _MSC_VER
|
||||
close(status_fd_);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
|
||||
String file() const { return file_; }
|
||||
int line() const { return line_; }
|
||||
int index() const { return index_; }
|
||||
int status_fd() const { return status_fd_; }
|
||||
|
||||
private:
|
||||
String file_;
|
||||
int line_;
|
||||
int index_;
|
||||
int status_fd_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
|
||||
};
|
||||
|
||||
// Returns a newly created InternalRunDeathTestFlag object with fields
|
||||
|
@ -34,7 +34,7 @@
|
||||
// This header file declares classes and functions used internally by
|
||||
// Google Test. They are subject to change without notice.
|
||||
//
|
||||
// This file is #included in testing/base/internal/gtest-internal.h
|
||||
// This file is #included in <gtest/internal/gtest-internal.h>.
|
||||
// Do not include this header file separately!
|
||||
|
||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
||||
@ -93,6 +93,12 @@ class FilePath {
|
||||
int number,
|
||||
const char* extension);
|
||||
|
||||
// Given directory = "dir", relative_path = "test.xml",
|
||||
// returns "dir/test.xml".
|
||||
// On Windows, uses \ as the separator rather than /.
|
||||
static FilePath ConcatPaths(const FilePath& directory,
|
||||
const FilePath& relative_path);
|
||||
|
||||
// Returns a pathname for a file that does not currently exist. The pathname
|
||||
// will be directory/base_name.extension or
|
||||
// directory/base_name_<number>.extension if directory/base_name.extension
|
||||
@ -164,6 +170,9 @@ class FilePath {
|
||||
// root directory per disk drive.)
|
||||
bool IsRootDirectory() const;
|
||||
|
||||
// Returns true if pathname describes an absolute path.
|
||||
bool IsAbsolutePath() const;
|
||||
|
||||
private:
|
||||
// Replaces multiple consecutive separators with a single separator.
|
||||
// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
|
||||
|
@ -37,20 +37,24 @@
|
||||
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
|
||||
#define GTEST_SRC_GTEST_INTERNAL_INL_H_
|
||||
|
||||
// GTEST_IMPLEMENTATION is defined iff the current translation unit is
|
||||
// part of Google Test's implementation.
|
||||
#ifndef GTEST_IMPLEMENTATION
|
||||
// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
|
||||
// part of Google Test's implementation; otherwise it's undefined.
|
||||
#if !GTEST_IMPLEMENTATION_
|
||||
// A user is trying to include this from his code - just say no.
|
||||
#error "gtest-internal-inl.h is part of Google Test's internal implementation."
|
||||
#error "It must not be included except by Google Test itself."
|
||||
#endif // GTEST_IMPLEMENTATION
|
||||
#endif // GTEST_IMPLEMENTATION_
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h> // For strtoll/_strtoul64.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#include <windows.h> // NOLINT
|
||||
#if GTEST_OS_WINDOWS
|
||||
#include <windows.h> // For DWORD.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@ -60,19 +64,10 @@ namespace testing {
|
||||
|
||||
// Declares the flags.
|
||||
//
|
||||
// We don't want the users to modify these flags in the code, but want
|
||||
// Google Test's own unit tests to be able to access them. Therefore we
|
||||
// declare them here as opposed to in gtest.h.
|
||||
GTEST_DECLARE_bool_(break_on_failure);
|
||||
GTEST_DECLARE_bool_(catch_exceptions);
|
||||
GTEST_DECLARE_string_(color);
|
||||
GTEST_DECLARE_string_(filter);
|
||||
GTEST_DECLARE_bool_(list_tests);
|
||||
GTEST_DECLARE_string_(output);
|
||||
GTEST_DECLARE_bool_(print_time);
|
||||
GTEST_DECLARE_int32_(repeat);
|
||||
GTEST_DECLARE_int32_(stack_trace_depth);
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
// We don't want the users to modify this flag in the code, but want
|
||||
// Google Test's own unit tests to be able to access it. Therefore we
|
||||
// declare it here as opposed to in gtest.h.
|
||||
GTEST_DECLARE_bool_(death_test_use_fork);
|
||||
|
||||
namespace internal {
|
||||
|
||||
@ -81,6 +76,7 @@ namespace internal {
|
||||
extern const TypeId kTestTypeIdInGoogleTest;
|
||||
|
||||
// Names of the flags (needed for parsing Google Test flags).
|
||||
const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
|
||||
const char kBreakOnFailureFlag[] = "break_on_failure";
|
||||
const char kCatchExceptionsFlag[] = "catch_exceptions";
|
||||
const char kColorFlag[] = "color";
|
||||
@ -89,6 +85,7 @@ const char kListTestsFlag[] = "list_tests";
|
||||
const char kOutputFlag[] = "output";
|
||||
const char kPrintTimeFlag[] = "print_time";
|
||||
const char kRepeatFlag[] = "repeat";
|
||||
const char kThrowOnFailureFlag[] = "throw_on_failure";
|
||||
|
||||
// This class saves the values of all Google Test flags in its c'tor, and
|
||||
// restores them in its d'tor.
|
||||
@ -96,37 +93,45 @@ class GTestFlagSaver {
|
||||
public:
|
||||
// The c'tor.
|
||||
GTestFlagSaver() {
|
||||
also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
|
||||
break_on_failure_ = GTEST_FLAG(break_on_failure);
|
||||
catch_exceptions_ = GTEST_FLAG(catch_exceptions);
|
||||
color_ = GTEST_FLAG(color);
|
||||
death_test_style_ = GTEST_FLAG(death_test_style);
|
||||
death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
|
||||
filter_ = GTEST_FLAG(filter);
|
||||
internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
|
||||
list_tests_ = GTEST_FLAG(list_tests);
|
||||
output_ = GTEST_FLAG(output);
|
||||
print_time_ = GTEST_FLAG(print_time);
|
||||
repeat_ = GTEST_FLAG(repeat);
|
||||
throw_on_failure_ = GTEST_FLAG(throw_on_failure);
|
||||
}
|
||||
|
||||
// The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
|
||||
~GTestFlagSaver() {
|
||||
GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
|
||||
GTEST_FLAG(break_on_failure) = break_on_failure_;
|
||||
GTEST_FLAG(catch_exceptions) = catch_exceptions_;
|
||||
GTEST_FLAG(color) = color_;
|
||||
GTEST_FLAG(death_test_style) = death_test_style_;
|
||||
GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
|
||||
GTEST_FLAG(filter) = filter_;
|
||||
GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
|
||||
GTEST_FLAG(list_tests) = list_tests_;
|
||||
GTEST_FLAG(output) = output_;
|
||||
GTEST_FLAG(print_time) = print_time_;
|
||||
GTEST_FLAG(repeat) = repeat_;
|
||||
GTEST_FLAG(throw_on_failure) = throw_on_failure_;
|
||||
}
|
||||
private:
|
||||
// Fields for saving the original values of flags.
|
||||
bool also_run_disabled_tests_;
|
||||
bool break_on_failure_;
|
||||
bool catch_exceptions_;
|
||||
String color_;
|
||||
String death_test_style_;
|
||||
bool death_test_use_fork_;
|
||||
String filter_;
|
||||
String internal_run_death_test_;
|
||||
bool list_tests_;
|
||||
@ -134,6 +139,7 @@ class GTestFlagSaver {
|
||||
bool print_time_;
|
||||
bool pretty_;
|
||||
internal::Int32 repeat_;
|
||||
bool throw_on_failure_;
|
||||
} GTEST_ATTRIBUTE_UNUSED_;
|
||||
|
||||
// Converts a Unicode code point to a narrow string in UTF-8 encoding.
|
||||
@ -164,6 +170,32 @@ String WideStringToUtf8(const wchar_t* str, int num_chars);
|
||||
// Returns the number of active threads, or 0 when there is an error.
|
||||
size_t GetThreadCount();
|
||||
|
||||
// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
|
||||
// if the variable is present. If a file already exists at this location, this
|
||||
// function will write over it. If the variable is present, but the file cannot
|
||||
// be created, prints an error and exits.
|
||||
void WriteToShardStatusFileIfNeeded();
|
||||
|
||||
// Checks whether sharding is enabled by examining the relevant
|
||||
// environment variable values. If the variables are present,
|
||||
// but inconsistent (e.g., shard_index >= total_shards), prints
|
||||
// an error and exits. If in_subprocess_for_death_test, sharding is
|
||||
// disabled because it must only be applied to the original test
|
||||
// process. Otherwise, we could filter out death tests we intended to execute.
|
||||
bool ShouldShard(const char* total_shards_str, const char* shard_index_str,
|
||||
bool in_subprocess_for_death_test);
|
||||
|
||||
// Parses the environment variable var as an Int32. If it is unset,
|
||||
// returns default_val. If it is not an Int32, prints an error and
|
||||
// and aborts.
|
||||
Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
|
||||
|
||||
// Given the total number of shards, the shard index, and the test id,
|
||||
// returns true iff the test should be run on this shard. The test id is
|
||||
// some arbitrary but unique non-negative integer assigned to each test
|
||||
// method. Assumes that 0 <= shard_index < total_shards.
|
||||
bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id);
|
||||
|
||||
// List is a simple singly-linked list container.
|
||||
//
|
||||
// We cannot use std::list as Microsoft's implementation of STL has
|
||||
@ -790,9 +822,10 @@ class UnitTestOptions {
|
||||
// Returns the output format, or "" for normal printed output.
|
||||
static String GetOutputFormat();
|
||||
|
||||
// Returns the name of the requested output file, or the default if none
|
||||
// was explicitly specified.
|
||||
static String GetOutputFile();
|
||||
// Returns the absolute path of the requested output file, or the
|
||||
// default (test_detail.xml in the original working directory) if
|
||||
// none was explicitly specified.
|
||||
static String GetAbsolutePathToOutputFile();
|
||||
|
||||
// Functions for processing the gtest_filter flag.
|
||||
|
||||
@ -808,7 +841,7 @@ class UnitTestOptions {
|
||||
static bool FilterMatchesTest(const String &test_case_name,
|
||||
const String &test_name);
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Function for supporting the gtest_catch_exception flag.
|
||||
|
||||
// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
|
||||
@ -891,6 +924,8 @@ class DefaultGlobalTestPartResultReporter
|
||||
|
||||
private:
|
||||
UnitTestImpl* const unit_test_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
|
||||
};
|
||||
|
||||
// This is the default per thread test part result reporter used in
|
||||
@ -905,6 +940,8 @@ class DefaultPerThreadTestPartResultReporter
|
||||
|
||||
private:
|
||||
UnitTestImpl* const unit_test_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
|
||||
};
|
||||
|
||||
// The private implementation of the UnitTest class. We don't protect
|
||||
@ -1066,7 +1103,7 @@ class UnitTestImpl {
|
||||
tear_down_tc)->AddTestInfo(test_info);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Returns ParameterizedTestCaseRegistry object used to keep track of
|
||||
// value-parameterized tests and instantiate and register them.
|
||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
|
||||
@ -1108,11 +1145,18 @@ class UnitTestImpl {
|
||||
ad_hoc_test_result_.Clear();
|
||||
}
|
||||
|
||||
enum ReactionToSharding {
|
||||
HONOR_SHARDING_PROTOCOL,
|
||||
IGNORE_SHARDING_PROTOCOL
|
||||
};
|
||||
|
||||
// Matches the full name of each test against the user-specified
|
||||
// filter to decide whether the test should run, then records the
|
||||
// result in each TestCase and TestInfo object.
|
||||
// If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
|
||||
// based on sharding variables in the environment.
|
||||
// Returns the number of tests that should run.
|
||||
int FilterTests();
|
||||
int FilterTests(ReactionToSharding shard_tests);
|
||||
|
||||
// Lists all the tests by name.
|
||||
void ListAllTests();
|
||||
@ -1139,7 +1183,7 @@ class UnitTestImpl {
|
||||
return gtest_trace_stack_.pointer();
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
// Returns a pointer to the parsed --gtest_internal_run_death_test
|
||||
// flag, or NULL if that flag was not specified.
|
||||
// This information is useful only in a death test child process.
|
||||
@ -1188,7 +1232,7 @@ class UnitTestImpl {
|
||||
|
||||
internal::List<TestCase*> test_cases_; // The list of TestCases.
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// ParameterizedTestRegistry object used to register value-parameterized
|
||||
// tests.
|
||||
internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
|
||||
@ -1237,7 +1281,7 @@ class UnitTestImpl {
|
||||
// How long the test took to run, in milliseconds.
|
||||
TimeInMillis elapsed_time_;
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
// The decomposed components of the gtest_internal_run_death_test flag,
|
||||
// parsed when RUN_ALL_TESTS is called.
|
||||
internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
|
||||
@ -1256,11 +1300,98 @@ inline UnitTestImpl* GetUnitTestImpl() {
|
||||
return UnitTest::GetInstance()->impl();
|
||||
}
|
||||
|
||||
// Internal helper functions for implementing the simple regular
|
||||
// expression matcher.
|
||||
bool IsInSet(char ch, const char* str);
|
||||
bool IsDigit(char ch);
|
||||
bool IsPunct(char ch);
|
||||
bool IsRepeat(char ch);
|
||||
bool IsWhiteSpace(char ch);
|
||||
bool IsWordChar(char ch);
|
||||
bool IsValidEscape(char ch);
|
||||
bool AtomMatchesChar(bool escaped, char pattern, char ch);
|
||||
bool ValidateRegex(const char* regex);
|
||||
bool MatchRegexAtHead(const char* regex, const char* str);
|
||||
bool MatchRepetitionAndRegexAtHead(
|
||||
bool escaped, char ch, char repeat, const char* regex, const char* str);
|
||||
bool MatchRegexAnywhere(const char* regex, const char* str);
|
||||
|
||||
// Parses the command line for Google Test flags, without initializing
|
||||
// other parts of Google Test.
|
||||
void ParseGoogleTestFlagsOnly(int* argc, char** argv);
|
||||
void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Returns the message describing the last system error, regardless of the
|
||||
// platform.
|
||||
String GetLastSystemErrorMessage();
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Provides leak-safe Windows kernel handle ownership.
|
||||
class AutoHandle {
|
||||
public:
|
||||
AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
|
||||
explicit AutoHandle(HANDLE handle) : handle_(handle) {}
|
||||
|
||||
~AutoHandle() { Reset(); }
|
||||
|
||||
HANDLE Get() const { return handle_; }
|
||||
void Reset() { Reset(INVALID_HANDLE_VALUE); }
|
||||
void Reset(HANDLE handle) {
|
||||
if (handle != handle_) {
|
||||
if (handle_ != INVALID_HANDLE_VALUE)
|
||||
::CloseHandle(handle_);
|
||||
handle_ = handle;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
HANDLE handle_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
|
||||
};
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Attempts to parse a string into a positive integer pointed to by the
|
||||
// number parameter. Returns true if that is possible.
|
||||
// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
|
||||
// it here.
|
||||
template <typename Integer>
|
||||
bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
|
||||
// Fail fast if the given string does not begin with a digit;
|
||||
// this bypasses strtoXXX's "optional leading whitespace and plus
|
||||
// or minus sign" semantics, which are undesirable here.
|
||||
if (str.empty() || !isdigit(str[0])) {
|
||||
return false;
|
||||
}
|
||||
errno = 0;
|
||||
|
||||
char* end;
|
||||
// BiggestConvertible is the largest integer type that system-provided
|
||||
// string-to-number conversion routines can return.
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef unsigned __int64 BiggestConvertible;
|
||||
const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
|
||||
#else
|
||||
typedef unsigned long long BiggestConvertible; // NOLINT
|
||||
const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
const bool parse_success = *end == '\0' && errno == 0;
|
||||
|
||||
// TODO(vladl@google.com): Convert this to compile time assertion when it is
|
||||
// available.
|
||||
GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
|
||||
|
||||
const Integer result = static_cast<Integer>(parsed);
|
||||
if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
|
||||
*number = result;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_OS_LINUX
|
||||
#if GTEST_OS_LINUX
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@ -566,7 +566,7 @@ class TestFactoryImpl : public TestFactoryBase {
|
||||
virtual Test* CreateTest() { return new TestClass; }
|
||||
};
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Predicate-formatters for implementing the HRESULT checking macros
|
||||
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
|
||||
@ -620,7 +620,7 @@ TestInfo* MakeAndRegisterTestInfo(
|
||||
TearDownTestCaseFunc tear_down_tc,
|
||||
TestFactoryBase* factory);
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// State of the definition of a type-parameterized test case.
|
||||
class TypedTestCasePState {
|
||||
@ -636,6 +636,7 @@ class TypedTestCasePState {
|
||||
fprintf(stderr, "%s Test %s must be defined before "
|
||||
"REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
|
||||
FormatFileLocation(file, line).c_str(), test_name, case_name);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
defined_test_names_.insert(test_name);
|
||||
@ -768,6 +769,9 @@ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count);
|
||||
// Returns the number of failed test parts in the given test result object.
|
||||
int GetFailedPartCount(const TestResult* result);
|
||||
|
||||
// A helper for suppressing warnings on unreachable code in some macros.
|
||||
bool AlwaysTrue();
|
||||
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
@ -784,12 +788,18 @@ int GetFailedPartCount(const TestResult* result);
|
||||
#define GTEST_SUCCESS_(message) \
|
||||
GTEST_MESSAGE_(message, ::testing::TPRT_SUCCESS)
|
||||
|
||||
// Suppresses MSVC warnings 4072 (unreachable code) for the code following
|
||||
// statement if it returns or throws (or doesn't return or throw in some
|
||||
// situations).
|
||||
#define GTEST_HIDE_UNREACHABLE_CODE_(statement) \
|
||||
if (::testing::internal::AlwaysTrue()) { statement; }
|
||||
|
||||
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const char* gtest_msg = "") { \
|
||||
bool gtest_caught_expected = false; \
|
||||
try { \
|
||||
statement; \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
} \
|
||||
catch (expected_exception const&) { \
|
||||
gtest_caught_expected = true; \
|
||||
@ -813,7 +823,7 @@ int GetFailedPartCount(const TestResult* result);
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const char* gtest_msg = "") { \
|
||||
try { \
|
||||
statement; \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
} \
|
||||
catch (...) { \
|
||||
gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
|
||||
@ -829,7 +839,7 @@ int GetFailedPartCount(const TestResult* result);
|
||||
if (const char* gtest_msg = "") { \
|
||||
bool gtest_caught_any = false; \
|
||||
try { \
|
||||
statement; \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
} \
|
||||
catch (...) { \
|
||||
gtest_caught_any = true; \
|
||||
@ -855,7 +865,7 @@ int GetFailedPartCount(const TestResult* result);
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const char* gtest_msg = "") { \
|
||||
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
|
||||
{ statement; } \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
|
||||
gtest_msg = "Expected: " #statement " doesn't generate new fatal " \
|
||||
"failures in the current thread.\n" \
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
|
||||
@ -2659,7 +2659,7 @@ class ValueArray50 {
|
||||
const T50 v50_;
|
||||
};
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
// Generates values from the Cartesian product of values produced
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#if GTEST_HAS_RTTI
|
||||
#include <typeinfo>
|
||||
|
@ -63,21 +63,15 @@
|
||||
|
||||
// This header defines the following utilities:
|
||||
//
|
||||
// Macros indicating the name of the Google C++ Testing Framework project:
|
||||
// GTEST_NAME - a string literal of the project name.
|
||||
// GTEST_FLAG_PREFIX - a string literal of the prefix all Google
|
||||
// Test flag names share.
|
||||
// GTEST_FLAG_PREFIX_UPPER - a string literal of the prefix all Google
|
||||
// Test flag names share, in upper case.
|
||||
//
|
||||
// Macros indicating the current platform:
|
||||
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
|
||||
// GTEST_OS_LINUX - defined iff compiled on Linux.
|
||||
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
|
||||
// GTEST_OS_SOLARIS - defined iff compiled on Sun Solaris.
|
||||
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
|
||||
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
|
||||
// GTEST_OS_ZOS - defined iff compiled on IBM z/OS.
|
||||
// Macros indicating the current platform (defined to 1 if compiled on
|
||||
// the given platform; otherwise undefined):
|
||||
// GTEST_OS_CYGWIN - Cygwin
|
||||
// GTEST_OS_LINUX - Linux
|
||||
// GTEST_OS_MAC - Mac OS X
|
||||
// GTEST_OS_SOLARIS - Sun Solaris
|
||||
// GTEST_OS_SYMBIAN - Symbian
|
||||
// GTEST_OS_WINDOWS - Windows
|
||||
// GTEST_OS_ZOS - z/OS
|
||||
//
|
||||
// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
|
||||
// most stable support. Since core members of the Google Test project
|
||||
@ -86,17 +80,19 @@
|
||||
// googletestframework@googlegroups.com (patches for fixing them are
|
||||
// even more welcome!).
|
||||
//
|
||||
// Note that it is possible that none of the GTEST_OS_ macros are defined.
|
||||
// Note that it is possible that none of the GTEST_OS_* macros are defined.
|
||||
//
|
||||
// Macros indicating available Google Test features:
|
||||
// GTEST_HAS_COMBINE - defined iff Combine construct is supported
|
||||
// in value-parameterized tests.
|
||||
// GTEST_HAS_DEATH_TEST - defined iff death tests are supported.
|
||||
// GTEST_HAS_PARAM_TEST - defined iff value-parameterized tests are
|
||||
// supported.
|
||||
// GTEST_HAS_TYPED_TEST - defined iff typed tests are supported.
|
||||
// GTEST_HAS_TYPED_TEST_P - defined iff type-parameterized tests are
|
||||
// supported.
|
||||
// Macros indicating available Google Test features (defined to 1 if
|
||||
// the corresponding feature is supported; otherwise undefined):
|
||||
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
|
||||
// tests)
|
||||
// GTEST_HAS_DEATH_TEST - death tests
|
||||
// GTEST_HAS_PARAM_TEST - value-parameterized tests
|
||||
// GTEST_HAS_TYPED_TEST - typed tests
|
||||
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
|
||||
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used.
|
||||
// GTEST_USES_SIMPLE_RE - our own simple regex is used;
|
||||
// the above two are mutually exclusive.
|
||||
//
|
||||
// Macros for basic C++ coding:
|
||||
// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
|
||||
@ -155,9 +151,11 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream> // Used for GTEST_CHECK_
|
||||
|
||||
#define GTEST_NAME "Google Test"
|
||||
#define GTEST_FLAG_PREFIX "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER "GTEST_"
|
||||
#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
|
||||
#define GTEST_FLAG_PREFIX_ "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
|
||||
#define GTEST_NAME_ "Google Test"
|
||||
#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
|
||||
|
||||
// Determines the version of gcc that is used to compile this.
|
||||
#ifdef __GNUC__
|
||||
@ -168,49 +166,76 @@
|
||||
|
||||
// Determines the platform on which Google Test is compiled.
|
||||
#ifdef __CYGWIN__
|
||||
#define GTEST_OS_CYGWIN
|
||||
#define GTEST_OS_CYGWIN 1
|
||||
#elif __SYMBIAN32__
|
||||
#define GTEST_OS_SYMBIAN
|
||||
#define GTEST_OS_SYMBIAN 1
|
||||
#elif defined _MSC_VER
|
||||
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
|
||||
// both "The OS is Windows" and "The compiler is MSVC". These
|
||||
// meanings really should be separated in order to better support
|
||||
// Windows compilers other than MSVC.
|
||||
#define GTEST_OS_WINDOWS
|
||||
#define GTEST_OS_WINDOWS 1
|
||||
#elif defined __APPLE__
|
||||
#define GTEST_OS_MAC
|
||||
#define GTEST_OS_MAC 1
|
||||
#elif defined __linux__
|
||||
#define GTEST_OS_LINUX
|
||||
#define GTEST_OS_LINUX 1
|
||||
#elif defined __MVS__
|
||||
#define GTEST_OS_ZOS
|
||||
#define GTEST_OS_ZOS 1
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
#define GTEST_OS_SOLARIS
|
||||
#define GTEST_OS_SOLARIS 1
|
||||
#elif defined(__HAIKU__)
|
||||
#define GTEST_OS_HAIKU
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
// included <stdlib.h>, which is guaranteed to define size_t through
|
||||
// <stddef.h>.
|
||||
#include <regex.h> // NOLINT
|
||||
#define GTEST_USES_POSIX_RE 1
|
||||
|
||||
#else
|
||||
|
||||
// <regex.h> may not be available on this platform. Use our own
|
||||
// simple regex implementation instead.
|
||||
#define GTEST_USES_SIMPLE_RE 1
|
||||
|
||||
#endif // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
// Defines GTEST_HAS_EXCEPTIONS to 1 if exceptions are enabled, or 0
|
||||
// otherwise.
|
||||
|
||||
#ifdef _MSC_VER // Compiled by MSVC?
|
||||
// Assumes that exceptions are enabled by default.
|
||||
#ifndef _HAS_EXCEPTIONS // MSVC uses this macro to enable exceptions.
|
||||
#define _HAS_EXCEPTIONS 1
|
||||
#endif // _HAS_EXCEPTIONS
|
||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
||||
#else // The compiler is not MSVC.
|
||||
// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. For
|
||||
// other compilers, we assume exceptions are disabled to be
|
||||
// conservative.
|
||||
#if defined(__GNUC__) && __EXCEPTIONS
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#else
|
||||
#define GTEST_HAS_EXCEPTIONS 0
|
||||
#endif // defined(__GNUC__) && __EXCEPTIONS
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Determines whether ::std::string and ::string are available.
|
||||
|
||||
#ifndef GTEST_HAS_STD_STRING
|
||||
// The user didn't tell us whether ::std::string is available, so we
|
||||
// need to figure it out.
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
// Assumes that exceptions are enabled by default.
|
||||
#ifndef _HAS_EXCEPTIONS
|
||||
#define _HAS_EXCEPTIONS 1
|
||||
#endif // _HAS_EXCEPTIONS
|
||||
// GTEST_HAS_EXCEPTIONS is non-zero iff exceptions are enabled. It is
|
||||
// always defined, while _HAS_EXCEPTIONS is defined only on Windows.
|
||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
||||
// On Windows, we can use ::std::string if the compiler version is VS
|
||||
// 2005 or above, or if exceptions are enabled.
|
||||
#define GTEST_HAS_STD_STRING ((_MSC_VER >= 1400) || GTEST_HAS_EXCEPTIONS)
|
||||
#else // We are on Linux or Mac OS.
|
||||
#define GTEST_HAS_EXCEPTIONS 0
|
||||
// need to figure it out. The only environment that we know
|
||||
// ::std::string is not available is MSVC 7.1 or lower with exceptions
|
||||
// disabled.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1400) && !GTEST_HAS_EXCEPTIONS
|
||||
#define GTEST_HAS_STD_STRING 0
|
||||
#else
|
||||
#define GTEST_HAS_STD_STRING 1
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#endif
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
#ifndef GTEST_HAS_GLOBAL_STRING
|
||||
@ -227,21 +252,23 @@
|
||||
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
|
||||
// is available.
|
||||
|
||||
#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS) || defined(GTEST_OS_HAIKU) || defined(_MINIX)
|
||||
// At least some versions of cygwin don't support ::std::wstring.
|
||||
#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || GTEST_OS_HAIKU || defined(_MINIX)
|
||||
// Cygwin 1.5 and below doesn't support ::std::wstring.
|
||||
// Cygwin 1.7 might add wstring support; this should be updated when clear.
|
||||
// Solaris' libc++ doesn't support it either.
|
||||
// Minix currently doesn't support it either.
|
||||
#define GTEST_HAS_STD_WSTRING 0
|
||||
#else
|
||||
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
|
||||
#endif // defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
#endif // GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
|
||||
#endif // GTEST_HAS_STD_WSTRING
|
||||
|
||||
#ifndef GTEST_HAS_GLOBAL_WSTRING
|
||||
// The user didn't tell us whether ::wstring is available, so we need
|
||||
// to figure it out.
|
||||
#define GTEST_HAS_GLOBAL_WSTRING GTEST_HAS_GLOBAL_STRING
|
||||
#define GTEST_HAS_GLOBAL_WSTRING \
|
||||
(GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
|
||||
#endif // GTEST_HAS_GLOBAL_WSTRING
|
||||
|
||||
#if GTEST_HAS_STD_STRING || GTEST_HAS_GLOBAL_STRING || \
|
||||
@ -295,13 +322,7 @@
|
||||
// Determines whether <pthread.h> is available.
|
||||
#ifndef GTEST_HAS_PTHREAD
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC)
|
||||
#define GTEST_HAS_PTHREAD 1
|
||||
#else
|
||||
#define GTEST_HAS_PTHREAD 0
|
||||
#endif // GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
|
||||
#endif // GTEST_HAS_PTHREAD
|
||||
|
||||
// Determines whether tr1/tuple is available. If you have tr1/tuple
|
||||
@ -342,33 +363,36 @@
|
||||
#ifndef GTEST_HAS_CLONE
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) && !defined(__ia64__)
|
||||
#if GTEST_OS_LINUX && !defined(__ia64__)
|
||||
#define GTEST_HAS_CLONE 1
|
||||
#else
|
||||
#define GTEST_HAS_CLONE 0
|
||||
#endif // defined(GTEST_OS_LINUX) && !defined(__ia64__)
|
||||
#endif // GTEST_OS_LINUX && !defined(__ia64__)
|
||||
|
||||
#endif // GTEST_HAS_CLONE
|
||||
|
||||
// Determines whether to support death tests.
|
||||
#if GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
|
||||
#define GTEST_HAS_DEATH_TEST
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
// included <stdlib.h>, which is guaranteed to define size_t through
|
||||
// <stddef.h>.
|
||||
#include <regex.h>
|
||||
// Google Test does not support death tests for VC 7.1 and earlier for
|
||||
// these reasons:
|
||||
// 1. std::vector does not build in VC 7.1 when exceptions are disabled.
|
||||
// 2. std::string does not build in VC 7.1 when exceptions are disabled
|
||||
// (this is covered by GTEST_HAS_STD_STRING guard).
|
||||
// 3. abort() in a VC 7.1 application compiled as GUI in debug config
|
||||
// pops up a dialog window that cannot be suppressed programmatically.
|
||||
#if GTEST_HAS_STD_STRING && (GTEST_OS_LINUX || \
|
||||
GTEST_OS_MAC || \
|
||||
GTEST_OS_CYGWIN || \
|
||||
(GTEST_OS_WINDOWS && _MSC_VER >= 1400))
|
||||
#define GTEST_HAS_DEATH_TEST 1
|
||||
#include <vector>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#endif // GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
|
||||
#endif
|
||||
|
||||
// Determines whether to support value-parameterized tests.
|
||||
|
||||
#if defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
// TODO(vladl@google.com): get the implementation rid of vector and list
|
||||
// to compile on MSVC 7.1.
|
||||
#define GTEST_HAS_PARAM_TEST
|
||||
#define GTEST_HAS_PARAM_TEST 1
|
||||
#endif // defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
|
||||
// Determines whether to support type-driven tests.
|
||||
@ -376,21 +400,19 @@
|
||||
// Typed tests need <typeinfo> and variadic macros, which gcc and VC
|
||||
// 8.0+ support.
|
||||
#if defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
#define GTEST_HAS_TYPED_TEST
|
||||
#define GTEST_HAS_TYPED_TEST_P
|
||||
#define GTEST_HAS_TYPED_TEST 1
|
||||
#define GTEST_HAS_TYPED_TEST_P 1
|
||||
#endif // defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
|
||||
// Determines whether to support Combine(). This only makes sense when
|
||||
// value-parameterized tests are enabled.
|
||||
#if defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE
|
||||
#endif // defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE 1
|
||||
#endif // GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
|
||||
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
||||
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
|
||||
defined(GTEST_OS_SYMBIAN)
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ 1
|
||||
#endif
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ \
|
||||
(GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN)
|
||||
|
||||
// Defines some utility macros.
|
||||
|
||||
@ -491,8 +513,6 @@ class scoped_ptr {
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
|
||||
};
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Defines RE.
|
||||
|
||||
// A simple C++ wrapper for <regex.h>. It uses the POSIX Enxtended
|
||||
@ -550,12 +570,16 @@ class RE {
|
||||
// String type here, in order to simplify dependencies between the
|
||||
// files.
|
||||
const char* pattern_;
|
||||
bool is_valid_;
|
||||
#if GTEST_USES_POSIX_RE
|
||||
regex_t full_regex_; // For FullMatch().
|
||||
regex_t partial_regex_; // For PartialMatch().
|
||||
bool is_valid_;
|
||||
};
|
||||
#else // GTEST_USES_SIMPLE_RE
|
||||
const char* full_pattern_; // For FullMatch();
|
||||
#endif
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(RE);
|
||||
};
|
||||
|
||||
// Defines logging utilities:
|
||||
// GTEST_LOG_() - logs messages at the specified severity level.
|
||||
@ -584,14 +608,17 @@ inline void FlushInfoLog() { fflush(NULL); }
|
||||
// CaptureStderr - starts capturing stderr.
|
||||
// GetCapturedStderr - stops capturing stderr and returns the captured string.
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_STD_STRING
|
||||
void CaptureStderr();
|
||||
::std::string GetCapturedStderr();
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
||||
extern ::std::vector<String> g_argvs;
|
||||
|
||||
void CaptureStderr();
|
||||
// GTEST_HAS_DEATH_TEST implies we have ::std::string.
|
||||
::std::string GetCapturedStderr();
|
||||
const ::std::vector<String>& GetArgvs();
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
@ -675,10 +702,15 @@ struct is_pointer : public false_type {};
|
||||
template <typename T>
|
||||
struct is_pointer<T*> : public true_type {};
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#define GTEST_PATH_SEP_ "\\"
|
||||
#else
|
||||
#define GTEST_PATH_SEP_ "/"
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Defines BiggestInt as the biggest signed integer type the compiler
|
||||
// supports.
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 BiggestInt;
|
||||
#else
|
||||
typedef long long BiggestInt; // NOLINT
|
||||
@ -736,7 +768,7 @@ class TypeWithSize<4> {
|
||||
template <>
|
||||
class TypeWithSize<8> {
|
||||
public:
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 Int;
|
||||
typedef unsigned __int64 UInt;
|
||||
#else
|
||||
@ -759,7 +791,7 @@ inline const char* GetEnv(const char* name) {
|
||||
#ifdef _WIN32_WCE // We are on Windows CE.
|
||||
// CE has no environment variables.
|
||||
return NULL;
|
||||
#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper.
|
||||
#elif GTEST_OS_WINDOWS // We are on Windows proper.
|
||||
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
|
@ -35,7 +35,7 @@
|
||||
// Google Test. They are subject to change without notice. They should not used
|
||||
// by code external to Google Test.
|
||||
//
|
||||
// This header file is #included by testing/base/internal/gtest-internal.h.
|
||||
// This header file is #included by <gtest/internal/gtest-internal.h>.
|
||||
// It should not be #included by other files.
|
||||
|
||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <cxxabi.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user