diff --git a/libc/test/UnitTest/ErrnoSetterMatcher.h b/libc/test/UnitTest/ErrnoSetterMatcher.h index b748c29751c328..6b15bd4e9b79a4 100644 --- a/libc/test/UnitTest/ErrnoSetterMatcher.h +++ b/libc/test/UnitTest/ErrnoSetterMatcher.h @@ -161,10 +161,22 @@ static internal::ErrnoSetterMatcher Fails(int ExpectedErrno, EQ(ExpectedErrno)); } +template class ErrnoSetterMatcherBuilder { +public: + template using Cmp = internal::Comparator; + ErrnoSetterMatcherBuilder(Cmp cmp) : return_cmp(cmp) {} + + internal::ErrnoSetterMatcher with_errno(Cmp cmp) { + return internal::ErrnoSetterMatcher(return_cmp, cmp); + } + +private: + Cmp return_cmp; +}; + template -static internal::ErrnoSetterMatcher -returns(internal::Comparator cmp) { - return internal::ErrnoSetterMatcher(cmp); +static ErrnoSetterMatcherBuilder returns(internal::Comparator cmp) { + return ErrnoSetterMatcherBuilder(cmp); } } // namespace ErrnoSetterMatcher