Skip to content

Commit dad1cdd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update googletest to 35b75a2
PR-URL: #58710 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent e0f94c9 commit dad1cdd

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

deps/googletest/include/gtest/gtest-matchers.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,35 @@ class GeMatcher
773773
static const char* NegatedDesc() { return "isn't >="; }
774774
};
775775

776+
// Same as `EqMatcher<Rhs>`, except that the `rhs` is stored as `StoredRhs` and
777+
// must be implicitly convertible to `Rhs`.
778+
template <typename Rhs, typename StoredRhs>
779+
class ImplicitCastEqMatcher {
780+
public:
781+
explicit ImplicitCastEqMatcher(const StoredRhs& rhs) : stored_rhs_(rhs) {}
782+
783+
using is_gtest_matcher = void;
784+
785+
template <typename Lhs>
786+
bool MatchAndExplain(const Lhs& lhs, std::ostream*) const {
787+
return lhs == rhs();
788+
}
789+
790+
void DescribeTo(std::ostream* os) const {
791+
*os << "is equal to ";
792+
UniversalPrint(rhs(), os);
793+
}
794+
void DescribeNegationTo(std::ostream* os) const {
795+
*os << "isn't equal to ";
796+
UniversalPrint(rhs(), os);
797+
}
798+
799+
private:
800+
Rhs rhs() const { return ImplicitCast_<Rhs>(stored_rhs_); }
801+
802+
StoredRhs stored_rhs_;
803+
};
804+
776805
template <typename T, typename = typename std::enable_if<
777806
std::is_constructible<std::string, T>::value>::type>
778807
using StringLike = T;

deps/googletest/src/gtest.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ GTEST_DEFINE_bool_(
269269
"True if and only if the test should fail if no test case (including "
270270
"disabled test cases) is linked.");
271271

272+
GTEST_DEFINE_bool_(
273+
fail_if_no_test_selected,
274+
testing::internal::BoolFromGTestEnv("fail_if_no_test_selected", false),
275+
"True if and only if the test should fail if no test case is selected to "
276+
"run. A test case is selected to run if it is not disabled and is matched "
277+
"by the filter flag so that it starts executing.");
278+
272279
GTEST_DEFINE_bool_(
273280
also_run_disabled_tests,
274281
testing::internal::BoolFromGTestEnv("also_run_disabled_tests", false),
@@ -6079,6 +6086,14 @@ bool UnitTestImpl::RunAllTests() {
60796086
TearDownEnvironment);
60806087
repeater->OnEnvironmentsTearDownEnd(*parent_);
60816088
}
6089+
} else if (GTEST_FLAG_GET(fail_if_no_test_selected)) {
6090+
// If there were no tests to run, bail if we were requested to be strict.
6091+
constexpr char kNoTestsSelectedMessage[] =
6092+
"No tests were selected to run. Please make sure at least one test "
6093+
"exists and is not disabled! If the test is sharded, you may have "
6094+
"defined more shards than test cases, which is wasteful.";
6095+
ColoredPrintf(GTestColor::kRed, "%s\n", kNoTestsSelectedMessage);
6096+
return false;
60826097
}
60836098

60846099
elapsed_time_ = timer.Elapsed();
@@ -6763,6 +6778,7 @@ static bool ParseGoogleTestFlag(const char* const arg) {
67636778
GTEST_INTERNAL_PARSE_FLAG(death_test_use_fork);
67646779
GTEST_INTERNAL_PARSE_FLAG(fail_fast);
67656780
GTEST_INTERNAL_PARSE_FLAG(fail_if_no_test_linked);
6781+
GTEST_INTERNAL_PARSE_FLAG(fail_if_no_test_selected);
67666782
GTEST_INTERNAL_PARSE_FLAG(filter);
67676783
GTEST_INTERNAL_PARSE_FLAG(internal_run_death_test);
67686784
GTEST_INTERNAL_PARSE_FLAG(list_tests);

0 commit comments

Comments
 (0)