mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Tests: Corrected test with immediate capture of errno
This commit is contained in:
parent
26f2cc8ac4
commit
168cc5b207
1 changed files with 6 additions and 3 deletions
|
@ -46,12 +46,15 @@ int main (int, char**)
|
|||
|
||||
// Verify strtoimax handling of proper integers.
|
||||
auto value = strtoimax ("42", nullptr, 10);
|
||||
t.ok (value == 42, "Platform: strtoimax '42' --> 42");
|
||||
t.ok (value == 42, "Platform: strtoimax '42' --> 42");
|
||||
|
||||
// Verify strtoimax handling of non-integers.
|
||||
// Must set errno to zero, and must read it immediately.
|
||||
errno = 0;
|
||||
value = strtoimax ("foobar", nullptr, 10);
|
||||
t.ok (value == 0, "Platform: strtoimax 'foobar' --> 0");
|
||||
t.ok (errno == EINVAL, "Platform: strtoimax errno --> EINVAL");
|
||||
auto captured_errno = errno;
|
||||
t.ok (value == 0, "Platform: strtoimax 'foobar' --> 0");
|
||||
t.ok (captured_errno == EINVAL, "Platform: strtoimax errno --> EINVAL");
|
||||
t.diag (format (errno));
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue