Issue 79713
Summary [libc][test] using `llvm-project/libc/test/UnitTest /ErrnoSetterMatcher.h` when applicable
Labels libc
Assignees
Reporter SchrodingerZhu
    https://github.com/llvm/llvm-project/pull/79573 introduces macros for `errno` handling. 
For unit tests, this can be further improved by using `ErrnoSetterMatcher`(which are clear errno properly to avoid interference with other tests).

For example,
```c++
int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_EQ(max_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
```
 can be refactored into
```
ASSERT_THAT(LIBC_NAMESPACE::sched_get_priority_max(policy), returns(EQ(-1)),with_errno(EQ(EINVAL)));
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to