Implements --gmock_catch_leaked_mocks and Mock::AllowLeak.
This commit is contained in:
		@@ -242,6 +242,21 @@ 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
 | 
			
		||||
@@ -260,26 +275,13 @@ typedef ::std::wstring wstring;
 | 
			
		||||
class GMockCheckProvider {
 | 
			
		||||
 public:
 | 
			
		||||
  GMockCheckProvider(const char* condition, const char* file, int line) {
 | 
			
		||||
    FormatFileLocation(file, line);
 | 
			
		||||
    FormatFileLocation(file, line, &::std::cerr);
 | 
			
		||||
    ::std::cerr << " ERROR: Condition " << condition << " failed. ";
 | 
			
		||||
  }
 | 
			
		||||
  ~GMockCheckProvider() {
 | 
			
		||||
    ::std::cerr << ::std::endl;
 | 
			
		||||
    abort();
 | 
			
		||||
  }
 | 
			
		||||
  void FormatFileLocation(const char* file, int line) {
 | 
			
		||||
    if (file == NULL)
 | 
			
		||||
      file = "unknown file";
 | 
			
		||||
    if (line < 0) {
 | 
			
		||||
      ::std::cerr << file << ":";
 | 
			
		||||
    } else {
 | 
			
		||||
#if _MSC_VER
 | 
			
		||||
      ::std::cerr << file << "(" << line << "):";
 | 
			
		||||
#else
 | 
			
		||||
      ::std::cerr << file << ":" << line << ":";
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  ::std::ostream& GetStream() { return ::std::cerr; }
 | 
			
		||||
};
 | 
			
		||||
#define GMOCK_CHECK_(condition) \
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user