merges
This commit is contained in:
		
							parent
							
								
									8170693de6
								
							
						
					
					
						commit
						1fb2e10cfe
					
				@ -31,11 +31,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
"""Tests the text output of Google C++ Mocking Framework.
 | 
					"""Tests the text output of Google C++ Mocking Framework.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SYNOPSIS
 | 
					To update the golden file:
 | 
				
			||||||
       gmock_output_test.py --build_dir=BUILD/DIR --gengolden
 | 
					gmock_output_test.py --build_dir=BUILD/DIR --gengolden
 | 
				
			||||||
         # where BUILD/DIR contains the built gmock_output_test_ file.
 | 
					# where BUILD/DIR contains the built gmock_output_test_ file.
 | 
				
			||||||
       gmock_output_test.py --gengolden
 | 
					gmock_output_test.py --gengolden
 | 
				
			||||||
       gmock_output_test.py
 | 
					gmock_output_test.py
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__author__ = 'wan@google.com (Zhanyong Wan)'
 | 
					__author__ = 'wan@google.com (Zhanyong Wan)'
 | 
				
			||||||
@ -176,5 +176,8 @@ if __name__ == '__main__':
 | 
				
			|||||||
    golden_file = open(GOLDEN_PATH, 'wb')
 | 
					    golden_file = open(GOLDEN_PATH, 'wb')
 | 
				
			||||||
    golden_file.write(output)
 | 
					    golden_file.write(output)
 | 
				
			||||||
    golden_file.close()
 | 
					    golden_file.close()
 | 
				
			||||||
 | 
					    # Suppress the error "googletest was imported but a call to its main()
 | 
				
			||||||
 | 
					    # was never detected."
 | 
				
			||||||
 | 
					    os._exit(0)
 | 
				
			||||||
  else:
 | 
					  else:
 | 
				
			||||||
    gmock_test_utils.Main()
 | 
					    gmock_test_utils.Main()
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,6 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Determines path to gtest_test_utils and imports it.
 | 
					# Determines path to gtest_test_utils and imports it.
 | 
				
			||||||
SCRIPT_DIR = os.path.dirname(__file__) or '.'
 | 
					SCRIPT_DIR = os.path.dirname(__file__) or '.'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -44,9 +43,10 @@ if os.path.isdir(gtest_tests_util_dir):
 | 
				
			|||||||
  GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir
 | 
					  GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
  GTEST_TESTS_UTIL_DIR = os.path.join(SCRIPT_DIR, '../../googletest/test')
 | 
					  GTEST_TESTS_UTIL_DIR = os.path.join(SCRIPT_DIR, '../../googletest/test')
 | 
				
			||||||
 | 
					 | 
				
			||||||
sys.path.append(GTEST_TESTS_UTIL_DIR)
 | 
					sys.path.append(GTEST_TESTS_UTIL_DIR)
 | 
				
			||||||
import gtest_test_utils  # pylint: disable-msg=C6204
 | 
					
 | 
				
			||||||
 | 
					# pylint: disable=C6204
 | 
				
			||||||
 | 
					import gtest_test_utils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def GetSourceDir():
 | 
					def GetSourceDir():
 | 
				
			||||||
 | 
				
			|||||||
@ -73,11 +73,9 @@
 | 
				
			|||||||
//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
 | 
					//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
 | 
				
			||||||
//                              are enabled.
 | 
					//                              are enabled.
 | 
				
			||||||
//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
 | 
					//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
 | 
				
			||||||
//                              is/isn't available (some systems define
 | 
					//                              is/isn't available
 | 
				
			||||||
//                              ::string, which is different to std::string).
 | 
					//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::wstring
 | 
				
			||||||
//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
 | 
					//                              is/isn't available
 | 
				
			||||||
//                              is/isn't available (some systems define
 | 
					 | 
				
			||||||
//                              ::wstring, which is different to std::wstring).
 | 
					 | 
				
			||||||
//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
 | 
					//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
 | 
				
			||||||
//                              expressions are/aren't available.
 | 
					//                              expressions are/aren't available.
 | 
				
			||||||
//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
 | 
					//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
 | 
				
			||||||
@ -178,7 +176,7 @@
 | 
				
			|||||||
//                            GTEST_HAS_POSIX_RE (see above) which users can
 | 
					//                            GTEST_HAS_POSIX_RE (see above) which users can
 | 
				
			||||||
//                            define themselves.
 | 
					//                            define themselves.
 | 
				
			||||||
//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
 | 
					//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
 | 
				
			||||||
//                            the above two are mutually exclusive.
 | 
					//                            the above _RE(s) are mutually exclusive.
 | 
				
			||||||
//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
 | 
					//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Misc public macros
 | 
					// Misc public macros
 | 
				
			||||||
@ -272,10 +270,12 @@
 | 
				
			|||||||
# include <TargetConditionals.h>
 | 
					# include <TargetConditionals.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Brings in the definition of HAS_GLOBAL_STRING.  This must be done
 | 
				
			||||||
 | 
					// BEFORE we test HAS_GLOBAL_STRING.
 | 
				
			||||||
 | 
					#include <string>  // NOLINT
 | 
				
			||||||
#include <algorithm>  // NOLINT
 | 
					#include <algorithm>  // NOLINT
 | 
				
			||||||
#include <iostream>  // NOLINT
 | 
					#include <iostream>  // NOLINT
 | 
				
			||||||
#include <sstream>  // NOLINT
 | 
					#include <sstream>  // NOLINT
 | 
				
			||||||
#include <string>  // NOLINT
 | 
					 | 
				
			||||||
#include <utility>
 | 
					#include <utility>
 | 
				
			||||||
#include <vector>  // NOLINT
 | 
					#include <vector>  // NOLINT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -806,9 +806,9 @@ using ::std::tuple_size;
 | 
				
			|||||||
// Google Test does not support death tests for VC 7.1 and earlier as
 | 
					// Google Test does not support death tests for VC 7.1 and earlier as
 | 
				
			||||||
// abort() in a VC 7.1 application compiled as GUI in debug config
 | 
					// abort() in a VC 7.1 application compiled as GUI in debug config
 | 
				
			||||||
// pops up a dialog window that cannot be suppressed programmatically.
 | 
					// pops up a dialog window that cannot be suppressed programmatically.
 | 
				
			||||||
#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
 | 
					#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS ||   \
 | 
				
			||||||
     (GTEST_OS_MAC && !GTEST_OS_IOS) || \
 | 
					     (GTEST_OS_MAC && !GTEST_OS_IOS) ||                         \
 | 
				
			||||||
     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
 | 
					     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) ||          \
 | 
				
			||||||
     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
 | 
					     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
 | 
				
			||||||
     GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NETBSD)
 | 
					     GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NETBSD)
 | 
				
			||||||
# define GTEST_HAS_DEATH_TEST 1
 | 
					# define GTEST_HAS_DEATH_TEST 1
 | 
				
			||||||
@ -824,9 +824,10 @@ using ::std::tuple_size;
 | 
				
			|||||||
# define GTEST_HAS_TYPED_TEST_P 1
 | 
					# define GTEST_HAS_TYPED_TEST_P 1
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Determines whether to support Combine().
 | 
					// Determines whether to support Combine(). This only makes sense when
 | 
				
			||||||
// The implementation doesn't work on Sun Studio since it doesn't
 | 
					// value-parameterized tests are enabled.  The implementation doesn't
 | 
				
			||||||
// understand templated conversion operators.
 | 
					// work on Sun Studio since it doesn't understand templated conversion
 | 
				
			||||||
 | 
					// operators.
 | 
				
			||||||
#if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC)
 | 
					#if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC)
 | 
				
			||||||
# define GTEST_HAS_COMBINE 1
 | 
					# define GTEST_HAS_COMBINE 1
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -73,7 +73,7 @@ namespace testing {
 | 
				
			|||||||
// Constants.
 | 
					// Constants.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// The default death test style.
 | 
					// The default death test style.
 | 
				
			||||||
static const char kDefaultDeathTestStyle[] = "fast";
 | 
					static const char kDefaultDeathTestStyle[] = "threadsafe";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GTEST_DEFINE_string_(
 | 
					GTEST_DEFINE_string_(
 | 
				
			||||||
    death_test_style,
 | 
					    death_test_style,
 | 
				
			||||||
@ -555,7 +555,13 @@ bool DeathTestImpl::Passed(bool status_ok) {
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case DIED:
 | 
					    case DIED:
 | 
				
			||||||
      if (status_ok) {
 | 
					      if (status_ok) {
 | 
				
			||||||
 | 
					# if GTEST_USES_PCRE
 | 
				
			||||||
 | 
					        // PCRE regexes support embedded NULs.
 | 
				
			||||||
 | 
					        // GTEST_USES_PCRE is defined only in google3 mode
 | 
				
			||||||
 | 
					        const bool matched = RE::PartialMatch(error_message, *regex());
 | 
				
			||||||
 | 
					# else
 | 
				
			||||||
        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
 | 
					        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
 | 
				
			||||||
 | 
					# endif  // GTEST_USES_PCRE
 | 
				
			||||||
        if (matched) {
 | 
					        if (matched) {
 | 
				
			||||||
          success = true;
 | 
					          success = true;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
				
			|||||||
@ -92,7 +92,7 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
 | 
				
			|||||||
    TestFlag('print_time', '0', '1')
 | 
					    TestFlag('print_time', '0', '1')
 | 
				
			||||||
    TestFlag('repeat', '999', '1')
 | 
					    TestFlag('repeat', '999', '1')
 | 
				
			||||||
    TestFlag('throw_on_failure', '1', '0')
 | 
					    TestFlag('throw_on_failure', '1', '0')
 | 
				
			||||||
    TestFlag('death_test_style', 'threadsafe', 'fast')
 | 
					    TestFlag('death_test_style', 'fast', 'threadsafe')
 | 
				
			||||||
    TestFlag('catch_exceptions', '0', '1')
 | 
					    TestFlag('catch_exceptions', '0', '1')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if IS_LINUX:
 | 
					    if IS_LINUX:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user