Page MenuHomePhabricator

[libcxx] [test] Use error_code::default_error_condition to check errors against the expected codes

Authored by mstorsjo on Nov 2 2020, 5:52 AM.



error_code returned from functions might not be of the generic category, but of the system category, which can have different error code values. Use default_error_condition() to remap errors to the generic category where possible, to allow comparing them to the expected values.

Use the ErrorIs() helper instead of a direct comparison against an excpected value.

Diff Detail

Event Timeline

mstorsjo created this revision.Nov 2 2020, 5:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2020, 5:52 AM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript
mstorsjo requested review of this revision.Nov 2 2020, 5:52 AM
ldionne accepted this revision.Nov 2 2020, 4:05 PM
ldionne added a subscriber: ldionne.

LGTM with my comments applied.


Can you please use static_cast instead of a C-style cast?


Same, static_cast.

This revision is now accepted and ready to land.Nov 2 2020, 4:05 PM