summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
Diffstat (limited to 'googletest')
-rw-r--r--googletest/docs/advanced.md46
-rw-r--r--googletest/docs/faq.md2
-rw-r--r--googletest/docs/primer.md33
-rw-r--r--googletest/include/gtest/gtest.h4
-rw-r--r--googletest/samples/sample9_unittest.cc8
-rw-r--r--googletest/src/gtest.cc62
-rw-r--r--googletest/test/googletest-listener-test.cc113
-rw-r--r--googletest/test/gtest_unittest.cc11
8 files changed, 236 insertions, 43 deletions
diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md
index 3ad7926..e05d317 100644
--- a/googletest/docs/advanced.md
+++ b/googletest/docs/advanced.md
@@ -101,12 +101,15 @@ If you already have a function or functor that returns `bool` (or a type that
can be implicitly converted to `bool`), you can use it in a *predicate
assertion* to get the function arguments printed for free:
+<!-- mdformat off(github rendering does not support multiline tables) -->
+
| Fatal assertion | Nonfatal assertion | Verifies |
| --------------------------------- | --------------------------------- | --------------------------- |
| `ASSERT_PRED1(pred1, val1)` | `EXPECT_PRED1(pred1, val1)` | `pred1(val1)` is true |
| `ASSERT_PRED2(pred2, val1, val2)` | `EXPECT_PRED2(pred2, val1, val2)` | `pred1(val1, val2)` is true |
| `...` | `...` | `...` |
+<!-- mdformat on-->
In the above, `predn` is an `n`-ary predicate function or functor, where `val1`,
`val2`, ..., and `valn` are its arguments. The assertion succeeds if the
predicate returns `true` when applied to the given arguments, and fails
@@ -328,19 +331,27 @@ want to learn more, see
#### Floating-Point Macros
+<!-- mdformat off(github rendering does not support multiline tables) -->
+
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------------------- | ------------------------------- | ---------------------------------------- |
| `ASSERT_FLOAT_EQ(val1, val2);` | `EXPECT_FLOAT_EQ(val1, val2);` | the two `float` values are almost equal |
| `ASSERT_DOUBLE_EQ(val1, val2);` | `EXPECT_DOUBLE_EQ(val1, val2);` | the two `double` values are almost equal |
+<!-- mdformat on-->
+
By "almost equal" we mean the values are within 4 ULP's from each other.
The following assertions allow you to choose the acceptable error bound:
+<!-- mdformat off(github rendering does not support multiline tables) -->
+
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------------------------- | ------------------------------------- | -------------------------------------------------------------------------------- |
| `ASSERT_NEAR(val1, val2, abs_error);` | `EXPECT_NEAR(val1, val2, abs_error);` | the difference between `val1` and `val2` doesn't exceed the given absolute error |
+<!-- mdformat on-->
+
#### Floating-Point Predicate-Format Functions
Some floating-point operations are useful, but not that often used. In order to
@@ -362,10 +373,14 @@ Verifies that `val1` is less than, or almost equal to, `val2`. You can replace
arguments passed to mock objects. A gMock *matcher* is basically a predicate
that knows how to describe itself. It can be used in these assertion macros:
+<!-- mdformat off(github rendering does not support multiline tables) -->
+
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------------------ | ------------------------------ | --------------------- |
| `ASSERT_THAT(value, matcher);` | `EXPECT_THAT(value, matcher);` | value matches matcher |
+<!-- mdformat on-->
+
For example, `StartsWith(prefix)` is a matcher that matches a string starting
with `prefix`, and you can write:
@@ -391,7 +406,8 @@ and you're ready to go.
### More String Assertions
-(Please read the [previous](#AssertThat) section first if you haven't.)
+(Please read the [previous](#asserting-using-gmock-matchers) section first if
+you haven't.)
You can use the gMock
[string matchers](../../googlemock/docs/cheat_sheet.md#string-matchers) with
@@ -1333,15 +1349,18 @@ for generating test parameters. They return what we call (surprise!) *parameter
generators*. Here is a summary of them, which are all in the `testing`
namespace:
+<!-- mdformat off(github rendering does not support multiline tables) -->
+
| Parameter Generator | Behavior |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `Range(begin, end [, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. |
| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. |
-| `ValuesIn(container)` and | Yields values from a C-style array, an |
-| : `ValuesIn(begin,end)` : STL-style container, or an iterator range `[begin, end)` |
+| `ValuesIn(container)` and `ValuesIn(begin,end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)` |
| `Bool()` | Yields sequence `{false, true}`. |
| `Combine(g1, g2, ..., gN)` | Yields all combinations (Cartesian product) as std\:\:tuples of the values generated by the `N` generators. |
+<!-- mdformat on-->
+
For more details, see the comments at the definitions of these functions.
The following statement will instantiate tests from the `FooTest` test suite
@@ -1394,7 +1413,10 @@ Please note that `INSTANTIATE_TEST_SUITE_P` will instantiate *all* tests in the
given test suite, whether their definitions come before or *after* the
`INSTANTIATE_TEST_SUITE_P` statement.
-You can see sample7_unittest.cc and sample8_unittest.cc for more examples.
+You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples.
+
+[sample7_unittest.cc]: ../samples/sample7_unittest.cc "Parameterized Test example"
+[sample8_unittest.cc]: ../samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
### Creating Value-Parameterized Abstract Tests
@@ -1433,7 +1455,7 @@ returns the value of `testing::PrintToString(GetParam())`. It does not work for
NOTE: test names must be non-empty, unique, and may only contain ASCII
alphanumeric characters. In particular, they
-[should not contain underscores](https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore)
+[should not contain underscores](faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore)
```c++
class MyTestSuite : public testing::TestWithParam<int> {};
@@ -1542,7 +1564,9 @@ TYPED_TEST(FooTest, DoesBlah) {
TYPED_TEST(FooTest, HasPropertyA) { ... }
```
-You can see sample6_unittest.cc
+You can see [sample6_unittest.cc] for a complete example.
+
+[sample6_unittest.cc]: ../samples/sample6_unittest.cc "Typed Test example"
## Type-Parameterized Tests
@@ -1617,7 +1641,7 @@ that type directly without `::testing::Types<...>`, like this:
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
```
-You can see `sample6_unittest.cc` for a complete example.
+You can see [sample6_unittest.cc] for a complete example.
## Testing Private Code
@@ -1985,7 +2009,9 @@ You can do so by adding one line:
```
Now, sit back and enjoy a completely different output from your tests. For more
-details, you can read this sample9_unittest.cc
+details, see [sample9_unittest.cc].
+
+[sample9_unittest.cc]: ../samples/sample9_unittest.cc "Event listener example"
You may append more than one listener to the list. When an `On*Start()` or
`OnTestPartResult()` event is fired, the listeners will receive it in the order
@@ -2010,7 +2036,9 @@ handle `OnTestPartResult()` *before* listeners that can generate failures. This
ensures that failures generated by the latter are attributed to the right test
by the former.
-We have a sample of failure-raising listener sample10_unittest.cc
+See [sample10_unittest.cc] for an example of a failure-raising listener.
+
+[sample10_unittest.cc]: ../samples/sample10_unittest.cc "Failure-raising listener example"
## Running Test Programs: Advanced Options
diff --git a/googletest/docs/faq.md b/googletest/docs/faq.md
index d6e7f54..9949fec 100644
--- a/googletest/docs/faq.md
+++ b/googletest/docs/faq.md
@@ -263,7 +263,7 @@ If necessary, you can continue to derive test fixtures from a derived fixture.
googletest has no limit on how deep the hierarchy can be.
For a complete example using derived test fixtures, see
-[googletest sample](https://github.com/google/googletest/blob/master/googletest/samples/sample5_unittest.cc)
+[sample5_unittest.cc](../samples/sample5_unittest.cc).
## My compiler complains "void value not ignored as it ought to be." What does this mean?
diff --git a/googletest/docs/primer.md b/googletest/docs/primer.md
index 2759820..cbb48ec 100644
--- a/googletest/docs/primer.md
+++ b/googletest/docs/primer.md
@@ -51,26 +51,34 @@ of misunderstanding these.
Historically, googletest started to use the term _Test Case_ for grouping
related tests, whereas current publications including the International Software
Testing Qualifications Board ([ISTQB](http://www.istqb.org/)) and various
-textbooks on Software Quality use the term _[Test
-Suite](http://glossary.istqb.org/search/test%20suite)_ for this.
+textbooks on Software Quality use the term _[Test Suite][istqb test suite]_ for
+this.
The related term _Test_, as it is used in the googletest, is corresponding to
-the term _[Test Case](http://glossary.istqb.org/search/test%20case)_ of ISTQB
-and others.
+the term _[Test Case][istqb test case]_ of ISTQB and others.
The term _Test_ is commonly of broad enough sense, including ISTQB's definition
of _Test Case_, so it's not much of a problem here. But the term _Test Case_ as
was used in Google Test is of contradictory sense and thus confusing.
-googletest recently started replacing the term _Test Case_ by _Test Suite_ The
-preferred API is TestSuite*. The older TestCase* API is being slowly deprecated
-and refactored away
+googletest recently started replacing the term _Test Case_ with _Test Suite_.
+The preferred API is *TestSuite*. The older TestCase API is being slowly
+deprecated and refactored away.
So please be aware of the different definitions of the terms:
-Meaning | googletest Term | [ISTQB](http://www.istqb.org/) Term
-:----------------------------------------------------------------------------------- | :---------------------- | :----------------------------------
-Exercise a particular program path with specific input values and verify the results | [TEST()](#simple-tests) | [Test Case](http://glossary.istqb.org/search/test%20case)
+| Meaning | googletest Term | [ISTQB](http://www.istqb.org/) |
+: : : Term :
+| :---------------- | :---------------------- | :----------------------------- |
+| Exercise a | [TEST()](#simple-tests) | [Test Case][istqb test case] |
+: particular : : :
+: program path with : : :
+: specific input : : :
+: values and verify : : :
+: the results : : :
+
+[istqb test case]: http://glossary.istqb.org/en/search/test%20case
+[istqb test suite]: http://glossary.istqb.org/en/search/test%20suite
## Basic Concepts
@@ -235,9 +243,8 @@ of two wide strings fails, their values will be printed as UTF-8 narrow strings.
**Availability**: Linux, Windows, Mac.
**See also**: For more string comparison tricks (substring, prefix, suffix, and
-regular expression matching, for example), see
-[this](https://github.com/google/googletest/blob/master/googletest/docs/advanced.md)
-in the Advanced googletest Guide.
+regular expression matching, for example), see [this](advanced.md) in the
+Advanced googletest Guide.
## Simple Tests
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index d12563c..fbff73e 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -412,6 +412,8 @@ class GTEST_API_ Test {
// test in test case Foo. Hence a sub-class can define its own
// SetUpTestSuite() method to shadow the one defined in the super
// class.
+ // Failures that happen during SetUpTestSuite are logged but otherwise
+ // ignored.
static void SetUpTestSuite() {}
// Tears down the stuff shared by all tests in this test suite.
@@ -420,6 +422,8 @@ class GTEST_API_ Test {
// test in test case Foo. Hence a sub-class can define its own
// TearDownTestSuite() method to shadow the one defined in the super
// class.
+ // Failures that happen during TearDownTestSuite are logged but otherwise
+ // ignored.
static void TearDownTestSuite() {}
// Legacy API is deprecated but still available
diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc
index c0d8ff2..e502d08 100644
--- a/googletest/samples/sample9_unittest.cc
+++ b/googletest/samples/sample9_unittest.cc
@@ -135,10 +135,10 @@ int main(int argc, char **argv) {
// This is an example of using the UnitTest reflection API to inspect test
// results. Here we discount failures from the tests we expected to fail.
int unexpectedly_failed_tests = 0;
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- const TestCase& test_case = *unit_test.GetTestCase(i);
- for (int j = 0; j < test_case.total_test_count(); ++j) {
- const TestInfo& test_info = *test_case.GetTestInfo(j);
+ for (int i = 0; i < unit_test.total_test_suite_count(); ++i) {
+ const testing::TestSuite& test_suite = *unit_test.GetTestSuite(i);
+ for (int j = 0; j < test_suite.total_test_count(); ++j) {
+ const TestInfo& test_info = *test_suite.GetTestInfo(j);
// Counts failed tests that were not meant to fail (those without
// 'Fails' in the name).
if (test_info.result()->Failed() &&
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 78b30c6..a74041e 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -1949,8 +1949,8 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
// Other unknown OSes may not define it either.
wint_t left, right;
do {
- left = towlower(*lhs++);
- right = towlower(*rhs++);
+ left = towlower(static_cast<wint_t>(*lhs++));
+ right = towlower(static_cast<wint_t>(*rhs++));
} while (left && left == right);
return left == right;
#endif // OS selector
@@ -3117,11 +3117,22 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
void OnTestIterationStart(const UnitTest& unit_test, int iteration) override;
void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override;
void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
- void OnTestCaseStart(const TestSuite& test_suite) override;
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+ void OnTestCaseStart(const TestCase& test_case) override;
+#else
+ void OnTestSuiteStart(const TestSuite& test_suite) override;
+#endif // OnTestCaseStart
+
void OnTestStart(const TestInfo& test_info) override;
+
void OnTestPartResult(const TestPartResult& result) override;
void OnTestEnd(const TestInfo& test_info) override;
- void OnTestCaseEnd(const TestSuite& test_suite) override;
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+ void OnTestCaseEnd(const TestCase& test_case) override;
+#else
+ void OnTestSuiteEnd(const TestSuite& test_suite) override;
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+
void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override;
void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
@@ -3175,7 +3186,22 @@ void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
fflush(stdout);
}
-void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestSuite& test_suite) {
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
+ const std::string counts =
+ FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
+ ColoredPrintf(COLOR_GREEN, "[----------] ");
+ printf("%s from %s", counts.c_str(), test_case.name());
+ if (test_case.type_param() == nullptr) {
+ printf("\n");
+ } else {
+ printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param());
+ }
+ fflush(stdout);
+}
+#else
+void PrettyUnitTestResultPrinter::OnTestSuiteStart(
+ const TestSuite& test_suite) {
const std::string counts =
FormatCountableNoun(test_suite.test_to_run_count(), "test", "tests");
ColoredPrintf(COLOR_GREEN, "[----------] ");
@@ -3187,6 +3213,7 @@ void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestSuite& test_suite) {
}
fflush(stdout);
}
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
@@ -3233,7 +3260,19 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
fflush(stdout);
}
-void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestSuite& test_suite) {
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
+ if (!GTEST_FLAG(print_time)) return;
+
+ const std::string counts =
+ FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
+ ColoredPrintf(COLOR_GREEN, "[----------] ");
+ printf("%s from %s (%s ms total)\n\n", counts.c_str(), test_case.name(),
+ internal::StreamableToString(test_case.elapsed_time()).c_str());
+ fflush(stdout);
+}
+#else
+void PrettyUnitTestResultPrinter::OnTestSuiteEnd(const TestSuite& test_suite) {
if (!GTEST_FLAG(print_time)) return;
const std::string counts =
@@ -3243,6 +3282,7 @@ void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestSuite& test_suite) {
internal::StreamableToString(test_suite.elapsed_time()).c_str());
fflush(stdout);
}
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
const UnitTest& /*unit_test*/) {
@@ -3367,17 +3407,17 @@ class TestEventRepeater : public TestEventListener {
void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override;
void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) override;
// Legacy API is deprecated but still available
-#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestCaseStart(const TestSuite& parameter) override;
-#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestSuiteStart(const TestSuite& parameter) override;
void OnTestStart(const TestInfo& test_info) override;
void OnTestPartResult(const TestPartResult& result) override;
void OnTestEnd(const TestInfo& test_info) override;
// Legacy API is deprecated but still available
-#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI
- void OnTestCaseEnd(const TestSuite& parameter) override;
-#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+ void OnTestCaseEnd(const TestCase& parameter) override;
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestSuiteEnd(const TestSuite& parameter) override;
void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override;
void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) override;
diff --git a/googletest/test/googletest-listener-test.cc b/googletest/test/googletest-listener-test.cc
index f50faaf..10457af 100644
--- a/googletest/test/googletest-listener-test.cc
+++ b/googletest/test/googletest-listener-test.cc
@@ -35,6 +35,7 @@
#include <vector>
#include "gtest/gtest.h"
+#include "gtest/internal/custom/gtest.h"
using ::testing::AddGlobalTestEnvironment;
using ::testing::Environment;
@@ -76,10 +77,11 @@ class EventRecordingListener : public TestEventListener {
void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnEnvironmentsSetUpEnd"));
}
-
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestCaseStart(const TestCase& /*test_case*/) override {
g_events->push_back(GetFullMethodName("OnTestCaseStart"));
}
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestStart(const TestInfo& /*test_info*/) override {
g_events->push_back(GetFullMethodName("OnTestStart"));
@@ -93,9 +95,11 @@ class EventRecordingListener : public TestEventListener {
g_events->push_back(GetFullMethodName("OnTestEnd"));
}
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnTestCaseEnd(const TestCase& /*test_case*/) override {
g_events->push_back(GetFullMethodName("OnTestCaseEnd"));
}
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnEnvironmentsTearDownStart"));
@@ -283,6 +287,9 @@ int main(int argc, char **argv) {
::testing::GTEST_FLAG(repeat) = 2;
int ret_val = RUN_ALL_TESTS();
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+
+ // The deprecated OnTestSuiteStart/OnTestCaseStart events are included
const char* const expected_events[] = {"1st.OnTestProgramStart",
"2nd.OnTestProgramStart",
"3rd.OnTestProgramStart",
@@ -393,6 +400,110 @@ int main(int argc, char **argv) {
"3rd.OnTestProgramEnd",
"2nd.OnTestProgramEnd",
"1st.OnTestProgramEnd"};
+#else
+ const char* const expected_events[] = {"1st.OnTestProgramStart",
+ "2nd.OnTestProgramStart",
+ "3rd.OnTestProgramStart",
+ "1st.OnTestIterationStart(0)",
+ "2nd.OnTestIterationStart(0)",
+ "3rd.OnTestIterationStart(0)",
+ "1st.OnEnvironmentsSetUpStart",
+ "2nd.OnEnvironmentsSetUpStart",
+ "3rd.OnEnvironmentsSetUpStart",
+ "Environment::SetUp",
+ "3rd.OnEnvironmentsSetUpEnd",
+ "2nd.OnEnvironmentsSetUpEnd",
+ "1st.OnEnvironmentsSetUpEnd",
+ "3rd.OnTestSuiteStart",
+ "ListenerTest::SetUpTestSuite",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "3rd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "3rd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "3rd.OnTestEnd",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "3rd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "3rd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "3rd.OnTestEnd",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "ListenerTest::TearDownTestSuite",
+ "3rd.OnTestSuiteEnd",
+ "1st.OnEnvironmentsTearDownStart",
+ "2nd.OnEnvironmentsTearDownStart",
+ "3rd.OnEnvironmentsTearDownStart",
+ "Environment::TearDown",
+ "3rd.OnEnvironmentsTearDownEnd",
+ "2nd.OnEnvironmentsTearDownEnd",
+ "1st.OnEnvironmentsTearDownEnd",
+ "3rd.OnTestIterationEnd(0)",
+ "2nd.OnTestIterationEnd(0)",
+ "1st.OnTestIterationEnd(0)",
+ "1st.OnTestIterationStart(1)",
+ "2nd.OnTestIterationStart(1)",
+ "3rd.OnTestIterationStart(1)",
+ "1st.OnEnvironmentsSetUpStart",
+ "2nd.OnEnvironmentsSetUpStart",
+ "3rd.OnEnvironmentsSetUpStart",
+ "Environment::SetUp",
+ "3rd.OnEnvironmentsSetUpEnd",
+ "2nd.OnEnvironmentsSetUpEnd",
+ "1st.OnEnvironmentsSetUpEnd",
+ "3rd.OnTestSuiteStart",
+ "ListenerTest::SetUpTestSuite",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "3rd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "3rd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "3rd.OnTestEnd",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "3rd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "3rd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "3rd.OnTestEnd",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "ListenerTest::TearDownTestSuite",
+ "3rd.OnTestSuiteEnd",
+ "1st.OnEnvironmentsTearDownStart",
+ "2nd.OnEnvironmentsTearDownStart",
+ "3rd.OnEnvironmentsTearDownStart",
+ "Environment::TearDown",
+ "3rd.OnEnvironmentsTearDownEnd",
+ "2nd.OnEnvironmentsTearDownEnd",
+ "1st.OnEnvironmentsTearDownEnd",
+ "3rd.OnTestIterationEnd(1)",
+ "2nd.OnTestIterationEnd(1)",
+ "1st.OnTestIterationEnd(1)",
+ "3rd.OnTestProgramEnd",
+ "2nd.OnTestProgramEnd",
+ "1st.OnTestProgramEnd"};
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
VerifyResults(events,
expected_events,
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 07ee171..2b00b70 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -2016,10 +2016,11 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestSuite(
const char* key) {
- const TestCase* test_case = UnitTest::GetInstance()->current_test_case();
- ASSERT_TRUE(test_case != nullptr);
+ const testing::TestSuite* test_suite =
+ UnitTest::GetInstance()->current_test_suite();
+ ASSERT_TRUE(test_suite != nullptr);
ExpectNonFatalFailureRecordingPropertyWithReservedKey(
- test_case->ad_hoc_test_result(), key);
+ test_suite->ad_hoc_test_result(), key);
}
void ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestSuite(
@@ -2049,8 +2050,10 @@ class UnitTestRecordPropertyTest :
"time");
Test::RecordProperty("test_case_key_1", "1");
+
const testing::TestSuite* test_suite =
- UnitTest::GetInstance()->current_test_case();
+ UnitTest::GetInstance()->current_test_suite();
+
ASSERT_TRUE(test_suite != nullptr);
ASSERT_EQ(1, test_suite->ad_hoc_test_result().test_property_count());