Fixes some broken tests.
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,3 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
docs/
|
/docs/
|
||||||
build/
|
/build/
|
||||||
|
|||||||
@@ -161,12 +161,21 @@ TestResults TestResults::operator+(const TestResults& other) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestResults& TestResults::operator+=(const TestResults& other) {
|
TestResults& TestResults::operator+=(const TestResults& other) {
|
||||||
error_messages_.insert(error_messages_.end(), other.error_messages_.begin(), other.error_messages_.end());
|
if (this != &other) {
|
||||||
|
error_messages_.insert(error_messages_.end(), other.error_messages_.begin(), other.error_messages_.end());
|
||||||
|
failure_messages_.insert(failure_messages_.end(), other.failure_messages_.begin(), other.failure_messages_.end());
|
||||||
|
skip_messages_.insert(skip_messages_.end(), other.skip_messages_.begin(), other.skip_messages_.end());
|
||||||
|
} else {
|
||||||
|
const auto other_error_messages = other.error_messages_;
|
||||||
|
error_messages_.insert(error_messages_.end(), other_error_messages.begin(), other_error_messages.end());
|
||||||
|
const auto other_failure_messages = other.failure_messages_;
|
||||||
|
failure_messages_.insert(failure_messages_.end(), other_failure_messages.begin(), other_failure_messages.end());
|
||||||
|
const auto other_skip_messages = other.skip_messages_;
|
||||||
|
skip_messages_.insert(skip_messages_.end(), other_skip_messages.begin(), other_skip_messages.end());
|
||||||
|
}
|
||||||
errors_ += other.errors_;
|
errors_ += other.errors_;
|
||||||
failed_ += other.failed_;
|
failed_ += other.failed_;
|
||||||
failure_messages_.insert(failure_messages_.end(), other.failure_messages_.begin(), other.failure_messages_.end());
|
|
||||||
passed_ += other.passed_;
|
passed_ += other.passed_;
|
||||||
skip_messages_.insert(skip_messages_.end(), other.skip_messages_.begin(), other.skip_messages_.end());
|
|
||||||
skipped_ += other.skipped_;
|
skipped_ += other.skipped_;
|
||||||
total_ += other.total_;
|
total_ += other.total_;
|
||||||
return *this;
|
return *this;
|
||||||
@@ -211,9 +220,11 @@ MaybeTestConfigureFunction Coalesce(MaybeTestConfigureFunction first, MaybeTestC
|
|||||||
if (first.has_value()) {
|
if (first.has_value()) {
|
||||||
if (second.has_value()) {
|
if (second.has_value()) {
|
||||||
// This is the only place we actually need to combine them.
|
// This is the only place we actually need to combine them.
|
||||||
return [&first, &second]() {
|
const auto& first_value = first.value();
|
||||||
first.value()();
|
const auto& second_value = second.value();
|
||||||
second.value()();
|
return [&first_value, &second_value]() {
|
||||||
|
first_value();
|
||||||
|
second_value();
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return first;
|
return first;
|
||||||
|
|||||||
@@ -441,9 +441,9 @@ TEST(TestSuite, ShouldCoerceValuesToTheCorrectTypes) {
|
|||||||
EXPECT_THAT(get<0>(test_data), Eq("Test Name"));
|
EXPECT_THAT(get<0>(test_data), Eq("Test Name"));
|
||||||
EXPECT_THAT(get<1>(test_data), Eq("Expected"));
|
EXPECT_THAT(get<1>(test_data), Eq("Expected"));
|
||||||
// Item 2 is checked below as inputs.
|
// Item 2 is checked below as inputs.
|
||||||
EXPECT_THAT(get<3>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<3>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<4>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<4>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<5>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<5>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<6>(test_data), Eq(false));
|
EXPECT_THAT(get<6>(test_data), Eq(false));
|
||||||
|
|
||||||
auto inputs = get<2>(test_data);
|
auto inputs = get<2>(test_data);
|
||||||
@@ -481,9 +481,9 @@ TEST(MakeTestSuite, ShouldMakeATestSuiteWithAVectorOfTestRuns) {
|
|||||||
EXPECT_THAT(get<0>(test_data), Eq("Test Name"));
|
EXPECT_THAT(get<0>(test_data), Eq("Test Name"));
|
||||||
EXPECT_THAT(get<1>(test_data), Eq("Expected"));
|
EXPECT_THAT(get<1>(test_data), Eq("Expected"));
|
||||||
// Item 2 is checked below as inputs.
|
// Item 2 is checked below as inputs.
|
||||||
EXPECT_THAT(get<3>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<3>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<4>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<4>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<5>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<5>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<6>(test_data), Eq(false));
|
EXPECT_THAT(get<6>(test_data), Eq(false));
|
||||||
|
|
||||||
auto inputs = get<2>(test_data);
|
auto inputs = get<2>(test_data);
|
||||||
@@ -512,18 +512,18 @@ TEST(MakeTestSuite, ShouldMakeATestSuiteWithAnInitializerListOfTestRuns) {
|
|||||||
EXPECT_THAT(get<0>(first), Eq("Suite Two"));
|
EXPECT_THAT(get<0>(first), Eq("Suite Two"));
|
||||||
// EXPECT_THAT(get<1>(first), Eq(fnToTest));
|
// EXPECT_THAT(get<1>(first), Eq(fnToTest));
|
||||||
EXPECT_THAT(get<2>(first).size(), Eq(1));
|
EXPECT_THAT(get<2>(first).size(), Eq(1));
|
||||||
EXPECT_THAT(get<3>(first), Ne(nullopt));
|
EXPECT_THAT(get<3>(first).has_value(), Eq(true));
|
||||||
EXPECT_THAT(get<4>(first), Ne(nullopt));
|
EXPECT_THAT(get<4>(first).has_value(), Eq(true));
|
||||||
EXPECT_THAT(get<5>(first), Ne(nullopt));
|
EXPECT_THAT(get<5>(first).has_value(), Eq(true));
|
||||||
EXPECT_THAT(get<6>(first), Eq(true));
|
EXPECT_THAT(get<6>(first), Eq(true));
|
||||||
|
|
||||||
auto test_data = *get<2>(first).begin();
|
auto test_data = *get<2>(first).begin();
|
||||||
EXPECT_THAT(get<0>(test_data), Eq("Test Name"));
|
EXPECT_THAT(get<0>(test_data), Eq("Test Name"));
|
||||||
EXPECT_THAT(get<1>(test_data), Eq("Expected"));
|
EXPECT_THAT(get<1>(test_data), Eq("Expected"));
|
||||||
// Item 2 is checked below as inputs.
|
// Item 2 is checked below as inputs.
|
||||||
EXPECT_THAT(get<3>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<3>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<4>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<4>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<5>(test_data), Ne(nullopt));
|
EXPECT_THAT(get<5>(test_data).has_value(), Eq(false));
|
||||||
EXPECT_THAT(get<6>(test_data), Eq(false));
|
EXPECT_THAT(get<6>(test_data), Eq(false));
|
||||||
|
|
||||||
auto inputs = get<2>(test_data);
|
auto inputs = get<2>(test_data);
|
||||||
|
|||||||
Reference in New Issue
Block a user