diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-09-16 07:02:02 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-09-16 07:02:02 +0000 |
commit | f5e1ce5b9237edbc2e524ae9ebcb2452dc842937 (patch) | |
tree | f02cea51a3eb519f36631db3e1826fd35624979d /include/gmock/internal/gmock-port.h | |
parent | c53b3dca1b9ad6a6480b13744753916146b891d3 (diff) | |
download | googletest-f5e1ce5b9237edbc2e524ae9ebcb2452dc842937.tar.gz googletest-f5e1ce5b9237edbc2e524ae9ebcb2452dc842937.tar.bz2 googletest-f5e1ce5b9237edbc2e524ae9ebcb2452dc842937.zip |
Adds new matcher Pair(). Replaces GMOCK_CHECK_ with GTEST_CHECK_ (by Vlad Losev).
Diffstat (limited to 'include/gmock/internal/gmock-port.h')
-rw-r--r-- | include/gmock/internal/gmock-port.h | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/include/gmock/internal/gmock-port.h b/include/gmock/internal/gmock-port.h index 6bee9966..0263491e 100644 --- a/include/gmock/internal/gmock-port.h +++ b/include/gmock/internal/gmock-port.h @@ -214,56 +214,6 @@ typedef ::wstring wstring; typedef ::std::wstring wstring; #endif // GTEST_HAS_GLOBAL_WSTRING -// Prints the file location in the format native to the compiler. -inline void FormatFileLocation(const char* file, int line, ::std::ostream* os) { - if (file == NULL) - file = "unknown file"; - if (line < 0) { - *os << file << ":"; - } else { -#if _MSC_VER - *os << file << "(" << line << "):"; -#else - *os << file << ":" << line << ":"; -#endif - } -} - -// INTERNAL IMPLEMENTATION - DO NOT USE. -// -// GMOCK_CHECK_ is an all mode assert. It aborts the program if the condition -// is not satisfied. -// Synopsys: -// GMOCK_CHECK_(boolean_condition); -// or -// GMOCK_CHECK_(boolean_condition) << "Additional message"; -// -// This checks the condition and if the condition is not satisfied -// it prints message about the condition violation, including the -// condition itself, plus additional message streamed into it, if any, -// and then it aborts the program. It aborts the program irrespective of -// whether it is built in the debug mode or not. - -class GMockCheckProvider { - public: - GMockCheckProvider(const char* condition, const char* file, int line) { - FormatFileLocation(file, line, &::std::cerr); - ::std::cerr << " ERROR: Condition " << condition << " failed. "; - } - ~GMockCheckProvider() { - ::std::cerr << ::std::endl; - posix::Abort(); - } - ::std::ostream& GetStream() { return ::std::cerr; } -}; -#define GMOCK_CHECK_(condition) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (condition) \ - ; \ - else \ - ::testing::internal::GMockCheckProvider(\ - #condition, __FILE__, __LINE__).GetStream() - } // namespace internal } // namespace testing |