mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-28 11:27:32 +09:00
re-introduce old nss im too tired for this
This commit is contained in:
parent
3c46be320d
commit
3a838106b9
2871 changed files with 1374431 additions and 1762417 deletions
|
|
@ -92,17 +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_SUITE_P(PrintingFailingParams,
|
||||
FailingParamTest,
|
||||
testing::Values(2));
|
||||
|
||||
// Tests that an empty value for the test suite basename yields just
|
||||
// the test name without any prior /
|
||||
class EmptyBasenameParamInst : public testing::TestWithParam<int> {};
|
||||
|
||||
TEST_P(EmptyBasenameParamInst, Passes) { EXPECT_EQ(1, GetParam()); }
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(, EmptyBasenameParamInst, testing::Values(1));
|
||||
INSTANTIATE_TEST_CASE_P(PrintingFailingParams,
|
||||
FailingParamTest,
|
||||
testing::Values(2));
|
||||
|
||||
static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
|
||||
|
||||
|
|
@ -182,7 +174,7 @@ TEST(SCOPED_TRACETest, AcceptedValues) {
|
|||
SCOPED_TRACE("literal string");
|
||||
SCOPED_TRACE(std::string("std::string"));
|
||||
SCOPED_TRACE(1337); // streamable type
|
||||
const char* null_value = nullptr;
|
||||
const char* null_value = NULL;
|
||||
SCOPED_TRACE(null_value);
|
||||
|
||||
ADD_FAILURE() << "Just checking that all these values work fine.";
|
||||
|
|
@ -314,8 +306,9 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
|
|||
printf("(expecting 6 failures)\n");
|
||||
|
||||
CheckPoints check_points;
|
||||
ThreadWithParam<CheckPoints*> thread(&ThreadWithScopedTrace, &check_points,
|
||||
nullptr);
|
||||
ThreadWithParam<CheckPoints*> thread(&ThreadWithScopedTrace,
|
||||
&check_points,
|
||||
NULL);
|
||||
check_points.n1.WaitForNotification();
|
||||
|
||||
{
|
||||
|
|
@ -372,13 +365,15 @@ class NonFatalFailureInFixtureConstructorTest : public testing::Test {
|
|||
ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor.";
|
||||
}
|
||||
|
||||
~NonFatalFailureInFixtureConstructorTest() override {
|
||||
~NonFatalFailureInFixtureConstructorTest() {
|
||||
ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor.";
|
||||
}
|
||||
|
||||
void SetUp() override { ADD_FAILURE() << "Expected failure #2, in SetUp()."; }
|
||||
virtual void SetUp() {
|
||||
ADD_FAILURE() << "Expected failure #2, in SetUp().";
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
virtual void TearDown() {
|
||||
ADD_FAILURE() << "Expected failure #4, in TearDown.";
|
||||
}
|
||||
};
|
||||
|
|
@ -395,17 +390,17 @@ class FatalFailureInFixtureConstructorTest : public testing::Test {
|
|||
Init();
|
||||
}
|
||||
|
||||
~FatalFailureInFixtureConstructorTest() override {
|
||||
~FatalFailureInFixtureConstructorTest() {
|
||||
ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor.";
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
virtual void SetUp() {
|
||||
ADD_FAILURE() << "UNEXPECTED failure in SetUp(). "
|
||||
<< "We should never get here, as the test fixture c'tor "
|
||||
<< "had a fatal failure.";
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
virtual void TearDown() {
|
||||
ADD_FAILURE() << "UNEXPECTED failure in TearDown(). "
|
||||
<< "We should never get here, as the test fixture c'tor "
|
||||
<< "had a fatal failure.";
|
||||
|
|
@ -426,15 +421,18 @@ TEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) {
|
|||
// Tests non-fatal failures in SetUp().
|
||||
class NonFatalFailureInSetUpTest : public testing::Test {
|
||||
protected:
|
||||
~NonFatalFailureInSetUpTest() override { Deinit(); }
|
||||
virtual ~NonFatalFailureInSetUpTest() {
|
||||
Deinit();
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
virtual void SetUp() {
|
||||
printf("(expecting 4 failures)\n");
|
||||
ADD_FAILURE() << "Expected failure #1, in SetUp().";
|
||||
}
|
||||
|
||||
void TearDown() override { FAIL() << "Expected failure #3, in TearDown()."; }
|
||||
|
||||
virtual void TearDown() {
|
||||
FAIL() << "Expected failure #3, in TearDown().";
|
||||
}
|
||||
private:
|
||||
void Deinit() {
|
||||
FAIL() << "Expected failure #4, in the test fixture d'tor.";
|
||||
|
|
@ -448,15 +446,18 @@ TEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) {
|
|||
// Tests fatal failures in SetUp().
|
||||
class FatalFailureInSetUpTest : public testing::Test {
|
||||
protected:
|
||||
~FatalFailureInSetUpTest() override { Deinit(); }
|
||||
virtual ~FatalFailureInSetUpTest() {
|
||||
Deinit();
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
virtual void SetUp() {
|
||||
printf("(expecting 3 failures)\n");
|
||||
FAIL() << "Expected failure #1, in SetUp().";
|
||||
}
|
||||
|
||||
void TearDown() override { FAIL() << "Expected failure #2, in TearDown()."; }
|
||||
|
||||
virtual void TearDown() {
|
||||
FAIL() << "Expected failure #2, in TearDown().";
|
||||
}
|
||||
private:
|
||||
void Deinit() {
|
||||
FAIL() << "Expected failure #3, in the test fixture d'tor.";
|
||||
|
|
@ -469,55 +470,109 @@ TEST_F(FatalFailureInSetUpTest, FailureInSetUp) {
|
|||
}
|
||||
|
||||
TEST(AddFailureAtTest, MessageContainsSpecifiedFileAndLineNumber) {
|
||||
ADD_FAILURE_AT("foo.cc", 42) << "Expected nonfatal failure in foo.cc";
|
||||
ADD_FAILURE_AT("foo.cc", 42) << "Expected failure in foo.cc";
|
||||
}
|
||||
|
||||
TEST(GtestFailAtTest, MessageContainsSpecifiedFileAndLineNumber) {
|
||||
GTEST_FAIL_AT("foo.cc", 42) << "Expected fatal failure in foo.cc";
|
||||
#if GTEST_IS_THREADSAFE
|
||||
|
||||
// A unary function that may die.
|
||||
void DieIf(bool should_die) {
|
||||
GTEST_CHECK_(!should_die) << " - death inside DieIf().";
|
||||
}
|
||||
|
||||
// The MixedUpTestSuiteTest test case verifies that Google Test will fail a
|
||||
// Tests running death tests in a multi-threaded context.
|
||||
|
||||
// Used for coordination between the main and the spawn thread.
|
||||
struct SpawnThreadNotifications {
|
||||
SpawnThreadNotifications() {}
|
||||
|
||||
Notification spawn_thread_started;
|
||||
Notification spawn_thread_ok_to_terminate;
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(SpawnThreadNotifications);
|
||||
};
|
||||
|
||||
// The function to be executed in the thread spawn by the
|
||||
// MultipleThreads test (below).
|
||||
static void ThreadRoutine(SpawnThreadNotifications* notifications) {
|
||||
// Signals the main thread that this thread has started.
|
||||
notifications->spawn_thread_started.Notify();
|
||||
|
||||
// Waits for permission to finish from the main thread.
|
||||
notifications->spawn_thread_ok_to_terminate.WaitForNotification();
|
||||
}
|
||||
|
||||
// This is a death-test test, but it's not named with a DeathTest
|
||||
// suffix. It starts threads which might interfere with later
|
||||
// death tests, so it must run after all other death tests.
|
||||
class DeathTestAndMultiThreadsTest : public testing::Test {
|
||||
protected:
|
||||
// Starts a thread and waits for it to begin.
|
||||
virtual void SetUp() {
|
||||
thread_.reset(new ThreadWithParam<SpawnThreadNotifications*>(
|
||||
&ThreadRoutine, ¬ifications_, NULL));
|
||||
notifications_.spawn_thread_started.WaitForNotification();
|
||||
}
|
||||
// Tells the thread to finish, and reaps it.
|
||||
// Depending on the version of the thread library in use,
|
||||
// a manager thread might still be left running that will interfere
|
||||
// with later death tests. This is unfortunate, but this class
|
||||
// cleans up after itself as best it can.
|
||||
virtual void TearDown() {
|
||||
notifications_.spawn_thread_ok_to_terminate.Notify();
|
||||
}
|
||||
|
||||
private:
|
||||
SpawnThreadNotifications notifications_;
|
||||
testing::internal::scoped_ptr<ThreadWithParam<SpawnThreadNotifications*> >
|
||||
thread_;
|
||||
};
|
||||
|
||||
#endif // GTEST_IS_THREADSAFE
|
||||
|
||||
// The MixedUpTestCaseTest 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 MixedUpTestSuiteWithSameTestNameTest test case verifies that
|
||||
// The MixedUpTestCaseWithSameTestNameTest 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 MixedUpTestSuiteTest : public testing::Test {
|
||||
class MixedUpTestCaseTest : public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(MixedUpTestSuiteTest, FirstTestFromNamespaceFoo) {}
|
||||
TEST_F(MixedUpTestSuiteTest, SecondTestFromNamespaceFoo) {}
|
||||
TEST_F(MixedUpTestCaseTest, FirstTestFromNamespaceFoo) {}
|
||||
TEST_F(MixedUpTestCaseTest, SecondTestFromNamespaceFoo) {}
|
||||
|
||||
class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
|
||||
class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(MixedUpTestSuiteWithSameTestNameTest,
|
||||
TEST_F(MixedUpTestCaseWithSameTestNameTest,
|
||||
TheSecondTestWithThisNameShouldFail) {}
|
||||
|
||||
} // namespace foo
|
||||
|
||||
namespace bar {
|
||||
|
||||
class MixedUpTestSuiteTest : public testing::Test {
|
||||
class MixedUpTestCaseTest : 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(MixedUpTestSuiteTest, ThisShouldFail) {}
|
||||
TEST_F(MixedUpTestSuiteTest, ThisShouldFailToo) {}
|
||||
TEST_F(MixedUpTestCaseTest, ThisShouldFail) {}
|
||||
TEST_F(MixedUpTestCaseTest, ThisShouldFailToo) {}
|
||||
|
||||
class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
|
||||
class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
|
||||
};
|
||||
|
||||
// Expected to fail. We rely on the golden file to check that Google Test
|
||||
// generates the right error message.
|
||||
TEST_F(MixedUpTestSuiteWithSameTestNameTest,
|
||||
TEST_F(MixedUpTestCaseWithSameTestNameTest,
|
||||
TheSecondTestWithThisNameShouldFail) {}
|
||||
|
||||
} // namespace bar
|
||||
|
|
@ -728,27 +783,19 @@ TEST_P(ParamTest, Failure) {
|
|||
EXPECT_EQ("b", GetParam()) << "Expected failure";
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PrintingStrings,
|
||||
ParamTest,
|
||||
testing::Values(std::string("a")),
|
||||
ParamNameFunc);
|
||||
INSTANTIATE_TEST_CASE_P(PrintingStrings,
|
||||
ParamTest,
|
||||
testing::Values(std::string("a")),
|
||||
ParamNameFunc);
|
||||
|
||||
// The case where a suite has INSTANTIATE_TEST_SUITE_P but not TEST_P.
|
||||
using NoTests = ParamTest;
|
||||
INSTANTIATE_TEST_SUITE_P(ThisIsOdd, NoTests, ::testing::Values("Hello"));
|
||||
|
||||
// fails under kErrorOnUninstantiatedParameterizedTest=true
|
||||
class DetectNotInstantiatedTest : public testing::TestWithParam<int> {};
|
||||
TEST_P(DetectNotInstantiatedTest, Used) { }
|
||||
|
||||
// This would make the test failure from the above go away.
|
||||
// INSTANTIATE_TEST_SUITE_P(Fix, DetectNotInstantiatedTest, testing::Values(1));
|
||||
// This #ifdef block tests the output of typed tests.
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
template <typename T>
|
||||
class TypedTest : public testing::Test {
|
||||
};
|
||||
|
||||
TYPED_TEST_SUITE(TypedTest, testing::Types<int>);
|
||||
TYPED_TEST_CASE(TypedTest, testing::Types<int>);
|
||||
|
||||
TYPED_TEST(TypedTest, Success) {
|
||||
EXPECT_EQ(0, TypeParam());
|
||||
|
|
@ -767,24 +814,29 @@ class TypedTestNames {
|
|||
public:
|
||||
template <typename T>
|
||||
static std::string GetName(int i) {
|
||||
if (std::is_same<T, char>::value)
|
||||
if (testing::internal::IsSame<T, char>::value)
|
||||
return std::string("char") + ::testing::PrintToString(i);
|
||||
if (std::is_same<T, int>::value)
|
||||
if (testing::internal::IsSame<T, int>::value)
|
||||
return std::string("int") + ::testing::PrintToString(i);
|
||||
}
|
||||
};
|
||||
|
||||
TYPED_TEST_SUITE(TypedTestWithNames, TypesForTestWithNames, TypedTestNames);
|
||||
TYPED_TEST_CASE(TypedTestWithNames, TypesForTestWithNames, TypedTestNames);
|
||||
|
||||
TYPED_TEST(TypedTestWithNames, Success) {}
|
||||
|
||||
TYPED_TEST(TypedTestWithNames, Failure) { FAIL(); }
|
||||
|
||||
#endif // GTEST_HAS_TYPED_TEST
|
||||
|
||||
// This #ifdef block tests the output of type-parameterized tests.
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
template <typename T>
|
||||
class TypedTestP : public testing::Test {
|
||||
};
|
||||
|
||||
TYPED_TEST_SUITE_P(TypedTestP);
|
||||
TYPED_TEST_CASE_P(TypedTestP);
|
||||
|
||||
TYPED_TEST_P(TypedTestP, Success) {
|
||||
EXPECT_EQ(0U, TypeParam());
|
||||
|
|
@ -794,41 +846,28 @@ TYPED_TEST_P(TypedTestP, Failure) {
|
|||
EXPECT_EQ(1U, TypeParam()) << "Expected failure";
|
||||
}
|
||||
|
||||
REGISTER_TYPED_TEST_SUITE_P(TypedTestP, Success, Failure);
|
||||
REGISTER_TYPED_TEST_CASE_P(TypedTestP, Success, Failure);
|
||||
|
||||
typedef testing::Types<unsigned char, unsigned int> UnsignedTypes;
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(Unsigned, TypedTestP, UnsignedTypes);
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
|
||||
|
||||
class TypedTestPNames {
|
||||
public:
|
||||
template <typename T>
|
||||
static std::string GetName(int i) {
|
||||
if (std::is_same<T, unsigned char>::value) {
|
||||
if (testing::internal::IsSame<T, unsigned char>::value) {
|
||||
return std::string("unsignedChar") + ::testing::PrintToString(i);
|
||||
}
|
||||
if (std::is_same<T, unsigned int>::value) {
|
||||
if (testing::internal::IsSame<T, unsigned int>::value) {
|
||||
return std::string("unsignedInt") + ::testing::PrintToString(i);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(UnsignedCustomName, TypedTestP, UnsignedTypes,
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(UnsignedCustomName, TypedTestP, UnsignedTypes,
|
||||
TypedTestPNames);
|
||||
|
||||
template <typename T>
|
||||
class DetectNotInstantiatedTypesTest : public testing::Test {};
|
||||
TYPED_TEST_SUITE_P(DetectNotInstantiatedTypesTest);
|
||||
TYPED_TEST_P(DetectNotInstantiatedTypesTest, Used) {
|
||||
TypeParam instantiate;
|
||||
(void)instantiate;
|
||||
}
|
||||
REGISTER_TYPED_TEST_SUITE_P(DetectNotInstantiatedTypesTest, Used);
|
||||
|
||||
// kErrorOnUninstantiatedTypeParameterizedTest=true would make the above fail.
|
||||
// Adding the following would make that test failure go away.
|
||||
//
|
||||
// typedef ::testing::Types<char, int, unsigned int> MyTypes;
|
||||
// INSTANTIATE_TYPED_TEST_SUITE_P(All, DetectNotInstantiatedTypesTest, MyTypes);
|
||||
#endif // GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
|
|
@ -838,6 +877,8 @@ REGISTER_TYPED_TEST_SUITE_P(DetectNotInstantiatedTypesTest, Used);
|
|||
TEST(ADeathTest, ShouldRunFirst) {
|
||||
}
|
||||
|
||||
# if GTEST_HAS_TYPED_TEST
|
||||
|
||||
// We rely on the golden file to verify that typed tests whose test
|
||||
// case name ends with DeathTest are run first.
|
||||
|
||||
|
|
@ -846,11 +887,15 @@ class ATypedDeathTest : public testing::Test {
|
|||
};
|
||||
|
||||
typedef testing::Types<int, double> NumericTypes;
|
||||
TYPED_TEST_SUITE(ATypedDeathTest, NumericTypes);
|
||||
TYPED_TEST_CASE(ATypedDeathTest, NumericTypes);
|
||||
|
||||
TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
|
||||
}
|
||||
|
||||
# endif // GTEST_HAS_TYPED_TEST
|
||||
|
||||
# if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
|
||||
// We rely on the golden file to verify that type-parameterized tests
|
||||
// whose test case name ends with DeathTest are run first.
|
||||
|
|
@ -859,14 +904,16 @@ template <typename T>
|
|||
class ATypeParamDeathTest : public testing::Test {
|
||||
};
|
||||
|
||||
TYPED_TEST_SUITE_P(ATypeParamDeathTest);
|
||||
TYPED_TEST_CASE_P(ATypeParamDeathTest);
|
||||
|
||||
TYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {
|
||||
}
|
||||
|
||||
REGISTER_TYPED_TEST_SUITE_P(ATypeParamDeathTest, ShouldRunFirst);
|
||||
REGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(My, ATypeParamDeathTest, NumericTypes);
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
|
||||
|
||||
# endif // GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
|
|
@ -919,7 +966,7 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
|
|||
class ExpectFailureWithThreadsTest : public ExpectFailureTest {
|
||||
protected:
|
||||
static void AddFailureInOtherThread(FailureMode failure) {
|
||||
ThreadWithParam<FailureMode> thread(&AddFailure, failure, nullptr);
|
||||
ThreadWithParam<FailureMode> thread(&AddFailure, failure, NULL);
|
||||
thread.Join();
|
||||
}
|
||||
};
|
||||
|
|
@ -987,64 +1034,16 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
|
|||
"Some other non-fatal failure.");
|
||||
}
|
||||
|
||||
class DynamicFixture : public testing::Test {
|
||||
protected:
|
||||
DynamicFixture() { printf("DynamicFixture()\n"); }
|
||||
~DynamicFixture() override { printf("~DynamicFixture()\n"); }
|
||||
void SetUp() override { printf("DynamicFixture::SetUp\n"); }
|
||||
void TearDown() override { printf("DynamicFixture::TearDown\n"); }
|
||||
|
||||
static void SetUpTestSuite() { printf("DynamicFixture::SetUpTestSuite\n"); }
|
||||
static void TearDownTestSuite() {
|
||||
printf("DynamicFixture::TearDownTestSuite\n");
|
||||
}
|
||||
};
|
||||
|
||||
template <bool Pass>
|
||||
class DynamicTest : public DynamicFixture {
|
||||
public:
|
||||
void TestBody() override { EXPECT_TRUE(Pass); }
|
||||
};
|
||||
|
||||
auto dynamic_test = (
|
||||
// Register two tests with the same fixture correctly.
|
||||
testing::RegisterTest(
|
||||
"DynamicFixture", "DynamicTestPass", nullptr, nullptr, __FILE__,
|
||||
__LINE__, []() -> DynamicFixture* { return new DynamicTest<true>; }),
|
||||
testing::RegisterTest(
|
||||
"DynamicFixture", "DynamicTestFail", nullptr, nullptr, __FILE__,
|
||||
__LINE__, []() -> DynamicFixture* { return new DynamicTest<false>; }),
|
||||
|
||||
// Register the same fixture with another name. That's fine.
|
||||
testing::RegisterTest(
|
||||
"DynamicFixtureAnotherName", "DynamicTestPass", nullptr, nullptr,
|
||||
__FILE__, __LINE__,
|
||||
[]() -> DynamicFixture* { return new DynamicTest<true>; }),
|
||||
|
||||
// Register two tests with the same fixture incorrectly.
|
||||
testing::RegisterTest(
|
||||
"BadDynamicFixture1", "FixtureBase", nullptr, nullptr, __FILE__,
|
||||
__LINE__, []() -> DynamicFixture* { return new DynamicTest<true>; }),
|
||||
testing::RegisterTest(
|
||||
"BadDynamicFixture1", "TestBase", nullptr, nullptr, __FILE__, __LINE__,
|
||||
[]() -> testing::Test* { return new DynamicTest<true>; }),
|
||||
|
||||
// Register two tests with the same fixture incorrectly by omitting the
|
||||
// return type.
|
||||
testing::RegisterTest(
|
||||
"BadDynamicFixture2", "FixtureBase", nullptr, nullptr, __FILE__,
|
||||
__LINE__, []() -> DynamicFixture* { return new DynamicTest<true>; }),
|
||||
testing::RegisterTest("BadDynamicFixture2", "Derived", nullptr, nullptr,
|
||||
__FILE__, __LINE__,
|
||||
[]() { return new DynamicTest<true>; }));
|
||||
|
||||
// Two test environments for testing testing::AddGlobalTestEnvironment().
|
||||
|
||||
class FooEnvironment : public testing::Environment {
|
||||
public:
|
||||
void SetUp() override { printf("%s", "FooEnvironment::SetUp() called.\n"); }
|
||||
virtual void SetUp() {
|
||||
printf("%s", "FooEnvironment::SetUp() called.\n");
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
virtual void TearDown() {
|
||||
printf("%s", "FooEnvironment::TearDown() called.\n");
|
||||
FAIL() << "Expected fatal failure.";
|
||||
}
|
||||
|
|
@ -1052,9 +1051,11 @@ class FooEnvironment : public testing::Environment {
|
|||
|
||||
class BarEnvironment : public testing::Environment {
|
||||
public:
|
||||
void SetUp() override { printf("%s", "BarEnvironment::SetUp() called.\n"); }
|
||||
virtual void SetUp() {
|
||||
printf("%s", "BarEnvironment::SetUp() called.\n");
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
virtual void TearDown() {
|
||||
printf("%s", "BarEnvironment::TearDown() called.\n");
|
||||
ADD_FAILURE() << "Expected non-fatal failure.";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue