Commit 0599a7b8 by misterg Committed by Gennadiy Civil

Googletest export

Change tests to use new Test Suite API PiperOrigin-RevId: 228908894
parent 2edadced
......@@ -89,9 +89,9 @@ if SUPPORTS_SEH_EXCEPTIONS:
self.assert_('SEH exception with code 0x2a thrown '
'in the test fixture\'s destructor'
in test_output)
self.assert_('SEH exception with code 0x2a thrown in SetUpTestCase()'
self.assert_('SEH exception with code 0x2a thrown in SetUpTestSuite()'
in test_output)
self.assert_('SEH exception with code 0x2a thrown in TearDownTestCase()'
self.assert_('SEH exception with code 0x2a thrown in TearDownTestSuite()'
in test_output)
self.assert_('SEH exception with code 0x2a thrown in SetUp()'
in test_output)
......@@ -134,29 +134,29 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
'"Standard C++ exception" thrown '
'in the test fixture\'s destructor'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInDestructorTest::TearDownTestCase() '
self.assert_('CxxExceptionInDestructorTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
def testCatchesCxxExceptionsInSetUpTestCase(self):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in SetUpTestSuite()' in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInConstructorTest::TearDownTestCase() '
self.assert_('CxxExceptionInConstructorTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTestCaseTest constructor '
self.assert_('CxxExceptionInSetUpTestSuiteTest constructor '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTestCaseTest destructor '
self.assert_('CxxExceptionInSetUpTestSuiteTest destructor '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTestCaseTest::SetUp() '
self.assert_('CxxExceptionInSetUpTestSuiteTest::SetUp() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTestCaseTest::TearDown() '
self.assert_('CxxExceptionInSetUpTestSuiteTest::TearDown() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTestCaseTest test body '
self.assert_('CxxExceptionInSetUpTestSuiteTest test body '
'called as expected.'
in EX_BINARY_OUTPUT)
......@@ -168,7 +168,7 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in SetUp()'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTest::TearDownTestCase() '
self.assert_('CxxExceptionInSetUpTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInSetUpTest destructor '
......@@ -186,7 +186,7 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in TearDown()'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInTearDownTest::TearDownTestCase() '
self.assert_('CxxExceptionInTearDownTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInTearDownTest destructor '
......@@ -197,7 +197,7 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assert_('C++ exception with description "Standard C++ exception"'
' thrown in the test body'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInTestBodyTest::TearDownTestCase() '
self.assert_('CxxExceptionInTestBodyTest::TearDownTestSuite() '
'called as expected.'
in EX_BINARY_OUTPUT)
self.assert_('CxxExceptionInTestBodyTest destructor '
......
......@@ -64,19 +64,20 @@ class SehExceptionInDestructorTest : public Test {
TEST_F(SehExceptionInDestructorTest, ThrowsExceptionInDestructor) {}
class SehExceptionInSetUpTestCaseTest : public Test {
class SehExceptionInSetUpTestSuiteTest : public Test {
public:
static void SetUpTestCase() { RaiseException(42, 0, 0, NULL); }
static void SetUpTestSuite() { RaiseException(42, 0, 0, NULL); }
};
TEST_F(SehExceptionInSetUpTestCaseTest, ThrowsExceptionInSetUpTestCase) {}
TEST_F(SehExceptionInSetUpTestSuiteTest, ThrowsExceptionInSetUpTestSuite) {}
class SehExceptionInTearDownTestCaseTest : public Test {
class SehExceptionInTearDownTestSuiteTest : public Test {
public:
static void TearDownTestCase() { RaiseException(42, 0, 0, NULL); }
static void TearDownTestSuite() { RaiseException(42, 0, 0, NULL); }
};
TEST_F(SehExceptionInTearDownTestCaseTest, ThrowsExceptionInTearDownTestCase) {}
TEST_F(SehExceptionInTearDownTestSuiteTest,
ThrowsExceptionInTearDownTestSuite) {}
class SehExceptionInSetUpTest : public Test {
protected:
......@@ -109,9 +110,9 @@ class CxxExceptionInConstructorTest : public Test {
throw std::runtime_error("Standard C++ exception"));
}
static void TearDownTestCase() {
static void TearDownTestSuite() {
printf("%s",
"CxxExceptionInConstructorTest::TearDownTestCase() "
"CxxExceptionInConstructorTest::TearDownTestSuite() "
"called as expected.\n");
}
......@@ -137,65 +138,65 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
<< "called unexpectedly.";
}
class CxxExceptionInSetUpTestCaseTest : public Test {
class CxxExceptionInSetUpTestSuiteTest : public Test {
public:
CxxExceptionInSetUpTestCaseTest() {
CxxExceptionInSetUpTestSuiteTest() {
printf("%s",
"CxxExceptionInSetUpTestCaseTest constructor "
"CxxExceptionInSetUpTestSuiteTest constructor "
"called as expected.\n");
}
static void SetUpTestCase() {
static void SetUpTestSuite() {
throw std::runtime_error("Standard C++ exception");
}
static void TearDownTestCase() {
static void TearDownTestSuite() {
printf("%s",
"CxxExceptionInSetUpTestCaseTest::TearDownTestCase() "
"CxxExceptionInSetUpTestSuiteTest::TearDownTestSuite() "
"called as expected.\n");
}
protected:
~CxxExceptionInSetUpTestCaseTest() override {
~CxxExceptionInSetUpTestSuiteTest() override {
printf("%s",
"CxxExceptionInSetUpTestCaseTest destructor "
"CxxExceptionInSetUpTestSuiteTest destructor "
"called as expected.\n");
}
void SetUp() override {
printf("%s",
"CxxExceptionInSetUpTestCaseTest::SetUp() "
"CxxExceptionInSetUpTestSuiteTest::SetUp() "
"called as expected.\n");
}
void TearDown() override {
printf("%s",
"CxxExceptionInSetUpTestCaseTest::TearDown() "
"CxxExceptionInSetUpTestSuiteTest::TearDown() "
"called as expected.\n");
}
};
TEST_F(CxxExceptionInSetUpTestCaseTest, ThrowsExceptionInSetUpTestCase) {
TEST_F(CxxExceptionInSetUpTestSuiteTest, ThrowsExceptionInSetUpTestSuite) {
printf("%s",
"CxxExceptionInSetUpTestCaseTest test body "
"CxxExceptionInSetUpTestSuiteTest test body "
"called as expected.\n");
}
class CxxExceptionInTearDownTestCaseTest : public Test {
class CxxExceptionInTearDownTestSuiteTest : public Test {
public:
static void TearDownTestCase() {
static void TearDownTestSuite() {
throw std::runtime_error("Standard C++ exception");
}
};
TEST_F(CxxExceptionInTearDownTestCaseTest, ThrowsExceptionInTearDownTestCase) {}
TEST_F(CxxExceptionInTearDownTestSuiteTest,
ThrowsExceptionInTearDownTestSuite) {}
class CxxExceptionInSetUpTest : public Test {
public:
static void TearDownTestCase() {
static void TearDownTestSuite() {
printf("%s",
"CxxExceptionInSetUpTest::TearDownTestCase() "
"CxxExceptionInSetUpTest::TearDownTestSuite() "
"called as expected.\n");
}
......@@ -222,9 +223,9 @@ TEST_F(CxxExceptionInSetUpTest, ThrowsExceptionInSetUp) {
class CxxExceptionInTearDownTest : public Test {
public:
static void TearDownTestCase() {
static void TearDownTestSuite() {
printf("%s",
"CxxExceptionInTearDownTest::TearDownTestCase() "
"CxxExceptionInTearDownTest::TearDownTestSuite() "
"called as expected.\n");
}
......@@ -244,9 +245,9 @@ TEST_F(CxxExceptionInTearDownTest, ThrowsExceptionInTearDown) {}
class CxxExceptionInTestBodyTest : public Test {
public:
static void TearDownTestCase() {
static void TearDownTestSuite() {
printf("%s",
"CxxExceptionInTestBodyTest::TearDownTestCase() "
"CxxExceptionInTestBodyTest::TearDownTestSuite() "
"called as expected.\n");
}
......
......@@ -1017,12 +1017,12 @@ class MacroLogicDeathTest : public testing::Test {
static testing::internal::ReplaceDeathTestFactory* replacer_;
static MockDeathTestFactory* factory_;
static void SetUpTestCase() {
static void SetUpTestSuite() {
factory_ = new MockDeathTestFactory;
replacer_ = new testing::internal::ReplaceDeathTestFactory(factory_);
}
static void TearDownTestCase() {
static void TearDownTestSuite() {
delete replacer_;
replacer_ = nullptr;
delete factory_;
......
......@@ -125,8 +125,8 @@ TEST_P(ParamTest, TestX) {
TEST_P(ParamTest, TestY) {
}
INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
INSTANTIATE_TEST_SUITE_P(SeqP, ParamTest, testing::Values(1, 2));
INSTANTIATE_TEST_SUITE_P(SeqQ, ParamTest, testing::Values(5, 6));
} // namespace
......
......@@ -241,8 +241,8 @@ EXPECTED_NON_EMPTY = {
u'disabled': 0,
u'errors': 0,
u'time': u'*',
u'SetUpTestCase': u'yes',
u'TearDownTestCase': u'aye',
u'SetUpTestSuite': u'yes',
u'TearDownTestSuite': u'aye',
u'testsuite': [
{
u'name': u'OneProperty',
......@@ -343,7 +343,7 @@ EXPECTED_NON_EMPTY = {
]
},
{
u'name': u'Single/TypeParameterizedTestCase/0',
u'name': u'Single/TypeParameterizedTestSuite/0',
u'tests': 1,
u'failures': 0,
u'disabled': 0,
......@@ -355,12 +355,12 @@ EXPECTED_NON_EMPTY = {
u'type_param': u'int',
u'status': u'RUN',
u'time': u'*',
u'classname': u'Single/TypeParameterizedTestCase/0'
u'classname': u'Single/TypeParameterizedTestSuite/0'
}
]
},
{
u'name': u'Single/TypeParameterizedTestCase/1',
u'name': u'Single/TypeParameterizedTestSuite/1',
u'tests': 1,
u'failures': 0,
u'disabled': 0,
......@@ -372,7 +372,7 @@ EXPECTED_NON_EMPTY = {
u'type_param': u'long',
u'status': u'RUN',
u'time': u'*',
u'classname': u'Single/TypeParameterizedTestCase/1'
u'classname': u'Single/TypeParameterizedTestSuite/1'
}
]
},
......
......@@ -99,7 +99,7 @@ TEST_P(ValueParamTest, TestA) {
TEST_P(ValueParamTest, TestB) {
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
MyInstantiation, ValueParamTest,
testing::Values(MyType("one line"),
MyType("two\nlines"),
......@@ -123,7 +123,7 @@ class MyArray {
typedef testing::Types<VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName, // NOLINT
int*, MyArray<bool, 42> > MyTypes;
TYPED_TEST_CASE(TypedTest, MyTypes);
TYPED_TEST_SUITE(TypedTest, MyTypes);
TYPED_TEST(TypedTest, TestA) {
}
......@@ -137,7 +137,7 @@ template <typename T>
class TypeParamTest : public testing::Test {
};
TYPED_TEST_CASE_P(TypeParamTest);
TYPED_TEST_SUITE_P(TypeParamTest);
TYPED_TEST_P(TypeParamTest, TestA) {
}
......@@ -145,9 +145,9 @@ TYPED_TEST_P(TypeParamTest, TestA) {
TYPED_TEST_P(TypeParamTest, TestB) {
}
REGISTER_TYPED_TEST_CASE_P(TypeParamTest, TestA, TestB);
REGISTER_TYPED_TEST_SUITE_P(TypeParamTest, TestA, TestB);
INSTANTIATE_TYPED_TEST_CASE_P(My, TypeParamTest, MyTypes);
INSTANTIATE_TYPED_TEST_SUITE_P(My, TypeParamTest, MyTypes);
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
......
......@@ -40,7 +40,7 @@ using ::testing::AddGlobalTestEnvironment;
using ::testing::Environment;
using ::testing::InitGoogleTest;
using ::testing::Test;
using ::testing::TestCase;
using ::testing::TestSuite;
using ::testing::TestEventListener;
using ::testing::TestInfo;
using ::testing::TestPartResult;
......@@ -206,12 +206,12 @@ class EnvironmentInvocationCatcher : public Environment {
class ListenerTest : public Test {
protected:
static void SetUpTestCase() {
g_events->push_back("ListenerTest::SetUpTestCase");
static void SetUpTestSuite() {
g_events->push_back("ListenerTest::SetUpTestSuite");
}
static void TearDownTestCase() {
g_events->push_back("ListenerTest::TearDownTestCase");
static void TearDownTestSuite() {
g_events->push_back("ListenerTest::TearDownTestSuite");
}
void SetUp() override { g_events->push_back("ListenerTest::SetUp"); }
......@@ -299,7 +299,7 @@ int main(int argc, char **argv) {
"3rd.OnTestSuiteStart",
"1st.OnTestCaseStart",
"2nd.OnTestCaseStart",
"ListenerTest::SetUpTestCase",
"ListenerTest::SetUpTestSuite",
"1st.OnTestStart",
"2nd.OnTestStart",
"3rd.OnTestStart",
......@@ -324,7 +324,7 @@ int main(int argc, char **argv) {
"3rd.OnTestEnd",
"2nd.OnTestEnd",
"1st.OnTestEnd",
"ListenerTest::TearDownTestCase",
"ListenerTest::TearDownTestSuite",
"3rd.OnTestSuiteEnd",
"2nd.OnTestCaseEnd",
"1st.OnTestCaseEnd",
......@@ -351,7 +351,7 @@ int main(int argc, char **argv) {
"3rd.OnTestSuiteStart",
"1st.OnTestCaseStart",
"2nd.OnTestCaseStart",
"ListenerTest::SetUpTestCase",
"ListenerTest::SetUpTestSuite",
"1st.OnTestStart",
"2nd.OnTestStart",
"3rd.OnTestStart",
......@@ -376,7 +376,7 @@ int main(int argc, char **argv) {
"3rd.OnTestEnd",
"2nd.OnTestEnd",
"1st.OnTestEnd",
"ListenerTest::TearDownTestCase",
"ListenerTest::TearDownTestSuite",
"3rd.OnTestSuiteEnd",
"2nd.OnTestCaseEnd",
"1st.OnTestCaseEnd",
......
......@@ -384,16 +384,16 @@ Expected failure in foo.cc
Stack trace: (omitted)
[ FAILED ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
[----------] 4 tests from MixedUpTestCaseTest
[ RUN ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
[ OK ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
[ RUN ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
[ OK ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
[ RUN ] MixedUpTestCaseTest.ThisShouldFail
[----------] 4 tests from MixedUpTestSuiteTest
[ RUN ] MixedUpTestSuiteTest.FirstTestFromNamespaceFoo
[ OK ] MixedUpTestSuiteTest.FirstTestFromNamespaceFoo
[ RUN ] MixedUpTestSuiteTest.SecondTestFromNamespaceFoo
[ OK ] MixedUpTestSuiteTest.SecondTestFromNamespaceFoo
[ RUN ] MixedUpTestSuiteTest.ThisShouldFail
gtest.cc:#: Failure
Failed
All tests in the same test suite must use the same test fixture
class. However, in test suite MixedUpTestCaseTest,
class. However, in test suite MixedUpTestSuiteTest,
you defined test FirstTestFromNamespaceFoo and test ThisShouldFail
using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
......@@ -401,12 +401,12 @@ units and have the same name. You should probably rename one
of the classes to put the tests into different test suites.
Stack trace: (omitted)
[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
[ RUN ] MixedUpTestCaseTest.ThisShouldFailToo
[ FAILED ] MixedUpTestSuiteTest.ThisShouldFail
[ RUN ] MixedUpTestSuiteTest.ThisShouldFailToo
gtest.cc:#: Failure
Failed
All tests in the same test suite must use the same test fixture
class. However, in test suite MixedUpTestCaseTest,
class. However, in test suite MixedUpTestSuiteTest,
you defined test FirstTestFromNamespaceFoo and test ThisShouldFailToo
using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
......@@ -414,15 +414,15 @@ units and have the same name. You should probably rename one
of the classes to put the tests into different test suites.
Stack trace: (omitted)
[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
[----------] 2 tests from MixedUpTestCaseWithSameTestNameTest
[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ OK ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ FAILED ] MixedUpTestSuiteTest.ThisShouldFailToo
[----------] 2 tests from MixedUpTestSuiteWithSameTestNameTest
[ RUN ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ OK ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ RUN ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
gtest.cc:#: Failure
Failed
All tests in the same test suite must use the same test fixture
class. However, in test suite MixedUpTestCaseWithSameTestNameTest,
class. However, in test suite MixedUpTestSuiteWithSameTestNameTest,
you defined test TheSecondTestWithThisNameShouldFail and test TheSecondTestWithThisNameShouldFail
using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
......@@ -430,7 +430,7 @@ units and have the same name. You should probably rename one
of the classes to put the tests into different test suites.
Stack trace: (omitted)
[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ FAILED ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[----------] 2 tests from TEST_F_before_TEST_in_same_test_case
[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
[ OK ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
......@@ -871,7 +871,7 @@ Stack trace: (omitted)
[ FAILED ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
[----------] 2 tests from DynamicFixture
DynamicFixture::SetUpTestCase
DynamicFixture::SetUpTestSuite
[ RUN ] DynamicFixture.DynamicTestPass
DynamicFixture()
DynamicFixture::SetUp
......@@ -890,18 +890,18 @@ Stack trace: (omitted)
DynamicFixture::TearDown
~DynamicFixture()
[ FAILED ] DynamicFixture.DynamicTestFail
DynamicFixture::TearDownTestCase
DynamicFixture::TearDownTestSuite
[----------] 1 test from DynamicFixtureAnotherName
DynamicFixture::SetUpTestCase
DynamicFixture::SetUpTestSuite
[ RUN ] DynamicFixtureAnotherName.DynamicTestPass
DynamicFixture()
DynamicFixture::SetUp
DynamicFixture::TearDown
~DynamicFixture()
[ OK ] DynamicFixtureAnotherName.DynamicTestPass
DynamicFixture::TearDownTestCase
DynamicFixture::TearDownTestSuite
[----------] 2 tests from BadDynamicFixture1
DynamicFixture::SetUpTestCase
DynamicFixture::SetUpTestSuite
[ RUN ] BadDynamicFixture1.FixtureBase
DynamicFixture()
DynamicFixture::SetUp
......@@ -923,9 +923,9 @@ Stack trace: (omitted)
~DynamicFixture()
[ FAILED ] BadDynamicFixture1.TestBase
DynamicFixture::TearDownTestCase
DynamicFixture::TearDownTestSuite
[----------] 2 tests from BadDynamicFixture2
DynamicFixture::SetUpTestCase
DynamicFixture::SetUpTestSuite
[ RUN ] BadDynamicFixture2.FixtureBase
DynamicFixture()
DynamicFixture::SetUp
......@@ -947,7 +947,7 @@ Stack trace: (omitted)
~DynamicFixture()
[ FAILED ] BadDynamicFixture2.Derived
DynamicFixture::TearDownTestCase
DynamicFixture::TearDownTestSuite
[----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
googletest-output-test_.cc:#: Failure
......@@ -1006,9 +1006,9 @@ Stack trace: (omitted)
[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
[ FAILED ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ FAILED ] MixedUpTestSuiteTest.ThisShouldFail
[ FAILED ] MixedUpTestSuiteTest.ThisShouldFailToo
[ FAILED ] MixedUpTestSuiteWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
......
......@@ -92,9 +92,9 @@ TEST_P(FailingParamTest, Fails) {
// This generates a test which will fail. Google Test is expected to print
// its parameter when it outputs the list of all failed tests.
INSTANTIATE_TEST_CASE_P(PrintingFailingParams,
FailingParamTest,
testing::Values(2));
INSTANTIATE_TEST_SUITE_P(PrintingFailingParams,
FailingParamTest,
testing::Values(2));
static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
......@@ -521,48 +521,48 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
#endif // GTEST_IS_THREADSAFE
// The MixedUpTestCaseTest test case verifies that Google Test will fail a
// The MixedUpTestSuiteTest test case verifies that Google Test will fail a
// test if it uses a different fixture class than what other tests in
// the same test case use. It deliberately contains two fixture
// classes with the same name but defined in different namespaces.
// The MixedUpTestCaseWithSameTestNameTest test case verifies that
// The MixedUpTestSuiteWithSameTestNameTest test case verifies that
// when the user defines two tests with the same test case name AND
// same test name (but in different namespaces), the second test will
// fail.
namespace foo {
class MixedUpTestCaseTest : public testing::Test {
class MixedUpTestSuiteTest : public testing::Test {
};
TEST_F(MixedUpTestCaseTest, FirstTestFromNamespaceFoo) {}
TEST_F(MixedUpTestCaseTest, SecondTestFromNamespaceFoo) {}
TEST_F(MixedUpTestSuiteTest, FirstTestFromNamespaceFoo) {}
TEST_F(MixedUpTestSuiteTest, SecondTestFromNamespaceFoo) {}
class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
};
TEST_F(MixedUpTestCaseWithSameTestNameTest,
TEST_F(MixedUpTestSuiteWithSameTestNameTest,
TheSecondTestWithThisNameShouldFail) {}
} // namespace foo
namespace bar {
class MixedUpTestCaseTest : public testing::Test {
class MixedUpTestSuiteTest : public testing::Test {
};
// The following two tests are expected to fail. We rely on the
// golden file to check that Google Test generates the right error message.
TEST_F(MixedUpTestCaseTest, ThisShouldFail) {}
TEST_F(MixedUpTestCaseTest, ThisShouldFailToo) {}
TEST_F(MixedUpTestSuiteTest, ThisShouldFail) {}
TEST_F(MixedUpTestSuiteTest, ThisShouldFailToo) {}
class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
};
// Expected to fail. We rely on the golden file to check that Google Test
// generates the right error message.
TEST_F(MixedUpTestCaseWithSameTestNameTest,
TEST_F(MixedUpTestSuiteWithSameTestNameTest,
TheSecondTestWithThisNameShouldFail) {}
} // namespace bar
......@@ -773,10 +773,10 @@ TEST_P(ParamTest, Failure) {
EXPECT_EQ("b", GetParam()) << "Expected failure";
}
INSTANTIATE_TEST_CASE_P(PrintingStrings,
ParamTest,
testing::Values(std::string("a")),
ParamNameFunc);
INSTANTIATE_TEST_SUITE_P(PrintingStrings,
ParamTest,
testing::Values(std::string("a")),
ParamNameFunc);
// This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST
......@@ -785,7 +785,7 @@ template <typename T>
class TypedTest : public testing::Test {
};
TYPED_TEST_CASE(TypedTest, testing::Types<int>);
TYPED_TEST_SUITE(TypedTest, testing::Types<int>);
TYPED_TEST(TypedTest, Success) {
EXPECT_EQ(0, TypeParam());
......@@ -811,7 +811,7 @@ class TypedTestNames {
}
};
TYPED_TEST_CASE(TypedTestWithNames, TypesForTestWithNames, TypedTestNames);
TYPED_TEST_SUITE(TypedTestWithNames, TypesForTestWithNames, TypedTestNames);
TYPED_TEST(TypedTestWithNames, Success) {}
......@@ -826,7 +826,7 @@ template <typename T>
class TypedTestP : public testing::Test {
};
TYPED_TEST_CASE_P(TypedTestP);
TYPED_TEST_SUITE_P(TypedTestP);
TYPED_TEST_P(TypedTestP, Success) {
EXPECT_EQ(0U, TypeParam());
......@@ -836,10 +836,10 @@ TYPED_TEST_P(TypedTestP, Failure) {
EXPECT_EQ(1U, TypeParam()) << "Expected failure";
}
REGISTER_TYPED_TEST_CASE_P(TypedTestP, Success, Failure);
REGISTER_TYPED_TEST_SUITE_P(TypedTestP, Success, Failure);
typedef testing::Types<unsigned char, unsigned int> UnsignedTypes;
INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
INSTANTIATE_TYPED_TEST_SUITE_P(Unsigned, TypedTestP, UnsignedTypes);
class TypedTestPNames {
public:
......@@ -854,7 +854,7 @@ class TypedTestPNames {
}
};
INSTANTIATE_TYPED_TEST_CASE_P(UnsignedCustomName, TypedTestP, UnsignedTypes,
INSTANTIATE_TYPED_TEST_SUITE_P(UnsignedCustomName, TypedTestP, UnsignedTypes,
TypedTestPNames);
#endif // GTEST_HAS_TYPED_TEST_P
......@@ -877,7 +877,7 @@ class ATypedDeathTest : public testing::Test {
};
typedef testing::Types<int, double> NumericTypes;
TYPED_TEST_CASE(ATypedDeathTest, NumericTypes);
TYPED_TEST_SUITE(ATypedDeathTest, NumericTypes);
TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
}
......@@ -894,14 +894,14 @@ template <typename T>
class ATypeParamDeathTest : public testing::Test {
};
TYPED_TEST_CASE_P(ATypeParamDeathTest);
TYPED_TEST_SUITE_P(ATypeParamDeathTest);
TYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {
}
REGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);
REGISTER_TYPED_TEST_SUITE_P(ATypeParamDeathTest, ShouldRunFirst);
INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
INSTANTIATE_TYPED_TEST_SUITE_P(My, ATypeParamDeathTest, NumericTypes);
# endif // GTEST_HAS_TYPED_TEST_P
......@@ -1031,9 +1031,9 @@ class DynamicFixture : public testing::Test {
void SetUp() override { printf("DynamicFixture::SetUp\n"); }
void TearDown() override { printf("DynamicFixture::TearDown\n"); }
static void SetUpTestCase() { printf("DynamicFixture::SetUpTestCase\n"); }
static void TearDownTestCase() {
printf("DynamicFixture::TearDownTestCase\n");
static void SetUpTestSuite() { printf("DynamicFixture::SetUpTestSuite\n"); }
static void TearDownTestSuite() {
printf("DynamicFixture::TearDownTestSuite\n");
}
};
......
......@@ -36,10 +36,10 @@ class DummyTest : public ::testing::TestWithParam<const char *> {};
TEST_P(DummyTest, Dummy) {
}
INSTANTIATE_TEST_CASE_P(InvalidTestName,
DummyTest,
::testing::Values("InvalidWithQuotes"),
::testing::PrintToStringParamName());
INSTANTIATE_TEST_SUITE_P(InvalidTestName,
DummyTest,
::testing::Values("InvalidWithQuotes"),
::testing::PrintToStringParamName());
} // namespace
......
......@@ -41,10 +41,10 @@ std::string StringParamTestSuffix(
TEST_P(DummyTest, Dummy) {
}
INSTANTIATE_TEST_CASE_P(DuplicateTestNames,
DummyTest,
::testing::Values("a", "b", "a", "c"),
StringParamTestSuffix);
INSTANTIATE_TEST_SUITE_P(DuplicateTestNames,
DummyTest,
::testing::Values("a", "b", "a", "c"),
StringParamTestSuffix);
} // namespace
int main(int argc, char *argv[]) {
......
......@@ -44,7 +44,7 @@ class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
// Test fixture for testing instantiation of a test in multiple
// translation units.
class InstantiationInMultipleTranslaionUnitsTest
class InstantiationInMultipleTranslationUnitsTest
: public ::testing::TestWithParam<int> {
};
......
......@@ -46,16 +46,16 @@ ParamGenerator<int> extern_gen = Values(33);
// and instantiated in another. The test is defined in
// googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
// defined in gtest-param-test_test.h.
INSTANTIATE_TEST_CASE_P(MultiplesOf33,
ExternalInstantiationTest,
Values(33, 66));
INSTANTIATE_TEST_SUITE_P(MultiplesOf33,
ExternalInstantiationTest,
Values(33, 66));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined
// in googletest-param-test-test.cc and
// InstantiationInMultipleTranslaionUnitsTest fixture is defined in
// InstantiationInMultipleTranslationUnitsTest fixture is defined in
// gtest-param-test_test.h
INSTANTIATE_TEST_CASE_P(Sequence2,
InstantiationInMultipleTranslaionUnitsTest,
Values(42*3, 42*4, 42*5));
INSTANTIATE_TEST_SUITE_P(Sequence2,
InstantiationInMultipleTranslationUnitsTest,
Values(42*3, 42*4, 42*5));
......@@ -393,7 +393,7 @@ typedef testing::Types<
# endif // GTEST_HAS_GLOBAL_STRING
const char*> StringTypes;
TYPED_TEST_CASE(RETest, StringTypes);
TYPED_TEST_SUITE(RETest, StringTypes);
// Tests RE's implicit constructors.
TYPED_TEST(RETest, ImplicitConstructorWorks) {
......
......@@ -46,16 +46,16 @@ ParamGenerator<int> extern_gen_2 = Values(33);
// and instantiated in another. The test is defined in
// googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
// defined in gtest-param-test_test.h.
INSTANTIATE_TEST_CASE_P(MultiplesOf33,
ExternalInstantiationTest,
Values(33, 66));
INSTANTIATE_TEST_SUITE_P(MultiplesOf33,
ExternalInstantiationTest,
Values(33, 66));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined
// in googletest-param-test-test.cc and
// InstantiationInMultipleTranslaionUnitsTest fixture is defined in
// InstantiationInMultipleTranslationUnitsTest fixture is defined in
// gtest-param-test_test.h
INSTANTIATE_TEST_CASE_P(Sequence2,
InstantiationInMultipleTranslaionUnitsTest,
Values(42*3, 42*4, 42*5));
INSTANTIATE_TEST_SUITE_P(Sequence2,
InstantiationInMultipleTranslationUnitsTest,
Values(42*3, 42*4, 42*5));
......@@ -38,7 +38,7 @@
// Tests that the same type-parameterized test case can be
// instantiated in different translation units linked together.
// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)
INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest,
testing::Types<std::vector<int> >);
INSTANTIATE_TYPED_TEST_SUITE_P(Vector, ContainerTest,
testing::Types<std::vector<int> >);
#endif // GTEST_HAS_TYPED_TEST_P
......@@ -46,7 +46,7 @@ template <typename T>
class ContainerTest : public Test {
};
TYPED_TEST_CASE_P(ContainerTest);
TYPED_TEST_SUITE_P(ContainerTest);
TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) {
TypeParam container;
......@@ -57,8 +57,8 @@ TYPED_TEST_P(ContainerTest, InitialSizeIsZero) {
EXPECT_EQ(0U, container.size());
}
REGISTER_TYPED_TEST_CASE_P(ContainerTest,
CanBeDefaultConstructed, InitialSizeIsZero);
REGISTER_TYPED_TEST_SUITE_P(ContainerTest,
CanBeDefaultConstructed, InitialSizeIsZero);
#endif // GTEST_HAS_TYPED_TEST_P
......
......@@ -120,9 +120,9 @@ TEST_P(MyParamTest, ShouldPass) {
GTEST_CHECK_INT_EQ_(g_param_test_count % kNumberOfParamTests, GetParam());
g_param_test_count++;
}
INSTANTIATE_TEST_CASE_P(MyParamSequence,
MyParamTest,
testing::Range(0, kNumberOfParamTests));
INSTANTIATE_TEST_SUITE_P(MyParamSequence,
MyParamTest,
testing::Range(0, kNumberOfParamTests));
// Resets the count for each test.
void ResetCounts() {
......
......@@ -111,7 +111,7 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="SkippedTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Skipped" status="skipped" time="*" classname="SkippedTest"/>
</testsuite>
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestSuite="yes" TearDownTestSuite="aye">
<testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key_1" value="1"/>
......@@ -164,11 +164,11 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="TypedTest/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="TypedTest/1" />
</testsuite>
<testsuite name="Single/TypeParameterizedTestCase/0" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestCase/0" />
<testsuite name="Single/TypeParameterizedTestSuite/0" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestSuite/0" />
</testsuite>
<testsuite name="Single/TypeParameterizedTestCase/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestCase/1" />
<testsuite name="Single/TypeParameterizedTestSuite/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestSuite/1" />
</testsuite>
</testsuites>""" % {'stack': STACK_TRACE_TEMPLATE}
......@@ -186,7 +186,7 @@ EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
</testsuite>
<testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
<testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestSuite="yes" TearDownTestSuite="aye">
<testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key_1" value="2"/>
......
......@@ -101,8 +101,10 @@ TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
class PropertyRecordingTest : public Test {
public:
static void SetUpTestCase() { RecordProperty("SetUpTestCase", "yes"); }
static void TearDownTestCase() { RecordProperty("TearDownTestCase", "aye"); }
static void SetUpTestSuite() { RecordProperty("SetUpTestSuite", "yes"); }
static void TearDownTestSuite() {
RecordProperty("TearDownTestSuite", "aye");
}
};
TEST_F(PropertyRecordingTest, OneProperty) {
......@@ -150,28 +152,28 @@ TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
class ValueParamTest : public TestWithParam<int> {};
TEST_P(ValueParamTest, HasValueParamAttribute) {}
TEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {}
INSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42));
INSTANTIATE_TEST_SUITE_P(Single, ValueParamTest, Values(33, 42));
#if GTEST_HAS_TYPED_TEST
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for typed tests.
template <typename T> class TypedTest : public Test {};
typedef testing::Types<int, long> TypedTestTypes;
TYPED_TEST_CASE(TypedTest, TypedTestTypes);
TYPED_TEST_SUITE(TypedTest, TypedTestTypes);
TYPED_TEST(TypedTest, HasTypeParamAttribute) {}
#endif
#if GTEST_HAS_TYPED_TEST_P
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for type-parameterized tests.
template <typename T> class TypeParameterizedTestCase : public Test {};
TYPED_TEST_CASE_P(TypeParameterizedTestCase);
TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}
REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute);
typedef testing::Types<int, long> TypeParameterizedTestCaseTypes;
INSTANTIATE_TYPED_TEST_CASE_P(Single,
TypeParameterizedTestCase,
TypeParameterizedTestCaseTypes);
template <typename T>
class TypeParameterizedTestSuite : public Test {};
TYPED_TEST_SUITE_P(TypeParameterizedTestSuite);
TYPED_TEST_P(TypeParameterizedTestSuite, HasTypeParamAttribute) {}
REGISTER_TYPED_TEST_SUITE_P(TypeParameterizedTestSuite, HasTypeParamAttribute);
typedef testing::Types<int, long> TypeParameterizedTestSuiteTypes; // NOLINT
INSTANTIATE_TYPED_TEST_SUITE_P(Single, TypeParameterizedTestSuite,
TypeParameterizedTestSuiteTypes);
#endif
int main(int argc, char** argv) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment