Googletest export
Makes testing::ResultOf() work with non-copyable arguments. PiperOrigin-RevId: 271222632
This commit is contained in:
committed by
Gennadiy Civil
parent
a783ade7c2
commit
cb3f7ce1de
@@ -4318,6 +4318,16 @@ TEST(ResultOfTest, WorksForLambdas) {
|
||||
EXPECT_FALSE(matcher.Matches(1));
|
||||
}
|
||||
|
||||
TEST(ResultOfTest, WorksForNonCopyableArguments) {
|
||||
Matcher<std::unique_ptr<int>> matcher = ResultOf(
|
||||
[](const std::unique_ptr<int>& str_len) {
|
||||
return std::string(static_cast<size_t>(*str_len), 'x');
|
||||
},
|
||||
"xxx");
|
||||
EXPECT_TRUE(matcher.Matches(std::unique_ptr<int>(new int(3))));
|
||||
EXPECT_FALSE(matcher.Matches(std::unique_ptr<int>(new int(1))));
|
||||
}
|
||||
|
||||
const int* ReferencingFunction(const int& n) { return &n; }
|
||||
|
||||
struct ReferencingFunctor {
|
||||
|
||||
Reference in New Issue
Block a user