summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-12-16 23:34:59 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-12-16 23:34:59 (GMT)
commit88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384 (patch)
tree2ccb8a80d9d1ee12db0de85b03dc9e9ed957b25a /test
parent075b76bb96f1b6eac7dde41b47de0dd456b0f473 (diff)
downloadgoogletest-88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384.zip
googletest-88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384.tar.gz
googletest-88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384.tar.bz2
Removes uses of GTEST_HAS_STD_STRING.
Diffstat (limited to 'test')
-rw-r--r--test/gtest-death-test_test.cc2
-rw-r--r--test/gtest-message_test.cc4
-rw-r--r--test/gtest-port_test.cc2
-rwxr-xr-xtest/gtest_output_test.py28
-rw-r--r--test/gtest_unittest.cc18
-rwxr-xr-xtest/run_tests_util.py29
6 files changed, 40 insertions, 43 deletions
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc
index 288c70a..4dc85b4 100644
--- a/test/gtest-death-test_test.cc
+++ b/test/gtest-death-test_test.cc
@@ -449,10 +449,8 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
EXPECT_DEATH(GlobalFunction(), regex_str);
#endif // GTEST_HAS_GLOBAL_STRING
-#if GTEST_HAS_STD_STRING
const ::std::string regex_std_str(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex_std_str);
-#endif // GTEST_HAS_STD_STRING
}
// Tests that a non-void function can be used in a death test.
diff --git a/test/gtest-message_test.cc b/test/gtest-message_test.cc
index 6c43c33..f3dda11 100644
--- a/test/gtest-message_test.cc
+++ b/test/gtest-message_test.cc
@@ -92,8 +92,6 @@ TEST(MessageTest, StreamsNullCString) {
EXPECT_STREQ("(null)", ToCString(Message() << p));
}
-#if GTEST_HAS_STD_STRING
-
// Tests streaming std::string.
//
// As std::string has problem in MSVC when exception is disabled, we only
@@ -113,8 +111,6 @@ TEST(MessageTest, StreamsStringWithEmbeddedNUL) {
ToCString(Message() << string_with_nul));
}
-#endif // GTEST_HAS_STD_STRING
-
// Tests streaming a NUL char.
TEST(MessageTest, StreamsNULChar) {
EXPECT_STREQ("\\0", ToCString(Message() << '\0'));
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc
index a2b0059..551c98b 100644
--- a/test/gtest-port_test.cc
+++ b/test/gtest-port_test.cc
@@ -177,9 +177,7 @@ class RETest : public ::testing::Test {};
// Defines StringTypes as the list of all string types that class RE
// supports.
typedef testing::Types<
-#if GTEST_HAS_STD_STRING
::std::string,
-#endif // GTEST_HAS_STD_STRING
#if GTEST_HAS_GLOBAL_STRING
::string,
#endif // GTEST_HAS_GLOBAL_STRING
diff --git a/test/gtest_output_test.py b/test/gtest_output_test.py
index c8a38f5..8d9a40b 100755
--- a/test/gtest_output_test.py
+++ b/test/gtest_output_test.py
@@ -126,15 +126,15 @@ def RemoveTime(output):
def RemoveTestCounts(output):
"""Removes test counts from a Google Test program's output."""
- output = re.sub(r'\d+ tests, listed below',
+ output = re.sub(r'\d+ tests?, listed below',
'? tests, listed below', output)
output = re.sub(r'\d+ FAILED TESTS',
'? FAILED TESTS', output)
- output = re.sub(r'\d+ tests from \d+ test cases',
+ output = re.sub(r'\d+ tests? from \d+ test cases?',
'? tests from ? test cases', output)
- output = re.sub(r'\d+ tests from ([a-zA-Z_])',
+ output = re.sub(r'\d+ tests? from ([a-zA-Z_])',
r'? tests from \1', output)
- return re.sub(r'\d+ tests\.', '? tests.', output)
+ return re.sub(r'\d+ tests?\.', '? tests.', output)
def RemoveMatchingTests(test_output, pattern):
@@ -268,16 +268,16 @@ class GTestOutputTest(gtest_test_utils.TestCase):
normalized_actual = RemoveTestCounts(output)
normalized_golden = RemoveTestCounts(self.RemoveUnsupportedTests(golden))
- # This code is very handy when debugging test differences so I left it
- # here, commented.
- # open(os.path.join(
- # gtest_test_utils.GetSourceDir(),
- # '_gtest_output_test_normalized_actual.txt'), 'wb').write(
- # normalized_actual)
- # open(os.path.join(
- # gtest_test_utils.GetSourceDir(),
- # '_gtest_output_test_normalized_golden.txt'), 'wb').write(
- # normalized_golden)
+ # This code is very handy when debugging golden file differences:
+ if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):
+ open(os.path.join(
+ gtest_test_utils.GetSourceDir(),
+ '_gtest_output_test_normalized_actual.txt'), 'wb').write(
+ normalized_actual)
+ open(os.path.join(
+ gtest_test_utils.GetSourceDir(),
+ '_gtest_output_test_normalized_golden.txt'), 'wb').write(
+ normalized_golden)
self.assert_(normalized_golden == normalized_actual)
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index 9745f93..ba5eb60 100644
--- a/test/gtest_unittest.cc
+++ b/test/gtest_unittest.cc
@@ -1111,8 +1111,6 @@ TEST(StringTest, Constructors) {
EXPECT_EQ('c', s7.c_str()[3]);
}
-#if GTEST_HAS_STD_STRING
-
TEST(StringTest, ConvertsFromStdString) {
// An empty std::string.
const std::string src1("");
@@ -1152,8 +1150,6 @@ TEST(StringTest, ConvertsToStdString) {
EXPECT_EQ(std::string("x\0y", 3), dest3);
}
-#endif // GTEST_HAS_STD_STRING
-
#if GTEST_HAS_GLOBAL_STRING
TEST(StringTest, ConvertsFromGlobalString) {
@@ -2818,8 +2814,6 @@ TEST(IsSubstringTest, GeneratesCorrectMessageForCString) {
"needle", "haystack").failure_message());
}
-#if GTEST_HAS_STD_STRING
-
// Tests that IsSubstring returns the correct result when the input
// argument type is ::std::string.
TEST(IsSubstringTest, ReturnsCorrectResultsForStdString) {
@@ -2827,8 +2821,6 @@ TEST(IsSubstringTest, ReturnsCorrectResultsForStdString) {
EXPECT_FALSE(IsSubstring("", "", "hello", std::string("world")));
}
-#endif // GTEST_HAS_STD_STRING
-
#if GTEST_HAS_STD_WSTRING
// Tests that IsSubstring returns the correct result when the input
// argument type is ::std::wstring.
@@ -2879,8 +2871,6 @@ TEST(IsNotSubstringTest, GeneratesCorrectMessageForWideCString) {
L"needle", L"two needles").failure_message());
}
-#if GTEST_HAS_STD_STRING
-
// Tests that IsNotSubstring returns the correct result when the input
// argument type is ::std::string.
TEST(IsNotSubstringTest, ReturnsCorrectResultsForStdString) {
@@ -2900,8 +2890,6 @@ TEST(IsNotSubstringTest, GeneratesCorrectMessageForStdString) {
::std::string("needle"), "two needles").failure_message());
}
-#endif // GTEST_HAS_STD_STRING
-
#if GTEST_HAS_STD_WSTRING
// Tests that IsNotSubstring returns the correct result when the input
@@ -4575,7 +4563,6 @@ TEST(StreamableToStringTest, NullCString) {
// Tests using streamable values as assertion messages.
-#if GTEST_HAS_STD_STRING
// Tests using std::string as an assertion message.
TEST(StreamableTest, string) {
static const std::string str(
@@ -4596,8 +4583,6 @@ TEST(StreamableTest, stringWithEmbeddedNUL) {
"Here's a NUL\\0 and some more string");
}
-#endif // GTEST_HAS_STD_STRING
-
// Tests that we can output a NUL char.
TEST(StreamableTest, NULChar) {
EXPECT_FATAL_FAILURE({ // NOLINT
@@ -4720,7 +4705,6 @@ TEST(EqAssertionTest, WideChar) {
"Value of: wchar");
}
-#if GTEST_HAS_STD_STRING
// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
TEST(EqAssertionTest, StdString) {
// Compares a const char* to an std::string that has identical
@@ -4751,8 +4735,6 @@ TEST(EqAssertionTest, StdString) {
" Actual: \"A \\0 in the middle\"");
}
-#endif // GTEST_HAS_STD_STRING
-
#if GTEST_HAS_STD_WSTRING
// Tests using ::std::wstring values in {EXPECT|ASSERT}_EQ.
diff --git a/test/run_tests_util.py b/test/run_tests_util.py
index f1bb3e0..fb7fd38 100755
--- a/test/run_tests_util.py
+++ b/test/run_tests_util.py
@@ -152,6 +152,20 @@ def _GetGtestBuildDir(injected_os, script_dir, config):
'gtest/scons'))
+def _GetConfigFromBuildDir(build_dir):
+ """Extracts the configuration name from the build directory."""
+
+ # We don't want to depend on build_dir containing the correct path
+ # separators.
+ m = re.match(r'.*[\\/]([^\\/]+)[\\/][^\\/]+[\\/]scons[\\/]?$', build_dir)
+ if m:
+ return m.group(1)
+ else:
+ print >>sys.stderr, ('%s is an invalid build directory that does not '
+ 'correspond to any configuration.' % (build_dir,))
+ return ''
+
+
# All paths in this script are either absolute or relative to the current
# working directory, unless otherwise specified.
class TestRunner(object):
@@ -270,7 +284,8 @@ class TestRunner(object):
args,
named_configurations,
built_configurations,
- available_configurations=CONFIGS):
+ available_configurations=CONFIGS,
+ python_tests_to_skip=None):
"""Determines what tests should be run.
Args:
@@ -278,7 +293,9 @@ class TestRunner(object):
named_configurations: The list of configurations specified via -c or -a.
built_configurations: True if -b has been specified.
available_configurations: a list of configurations available on the
- current platform, injectable for testing.
+ current platform, injectable for testing.
+ python_tests_to_skip: a collection of (configuration, python test name)s
+ that need to be skipped.
Returns:
A tuple with 2 elements: the list of Python tests to run and the list of
@@ -356,7 +373,13 @@ class TestRunner(object):
python_test_pairs = []
for directory in build_dirs:
for test in selected_python_tests:
- python_test_pairs.append((directory, test))
+ config = _GetConfigFromBuildDir(directory)
+ file_name = os.path.basename(test)
+ if python_tests_to_skip and (config, file_name) in python_tests_to_skip:
+ print ('NOTE: %s is skipped for configuration %s, as it does not '
+ 'work there.' % (file_name, config))
+ else:
+ python_test_pairs.append((directory, test))
binary_test_pairs = []
for directory in build_dirs: