[libgens/tests] TestSuite: Reset errno after calling isatty().
authorDavid Korth <gerbilsoft@gerbilsoft.com>
Sat, 5 Sep 2015 02:41:28 +0000 (22:41 -0400)
committerDavid Korth <gerbilsoft@gerbilsoft.com>
Sat, 5 Sep 2015 02:41:28 +0000 (22:41 -0400)
commite368e56a91fd546d5ef02830095676bb05ccc1f5
treea0018bbc2418b4b0bee4a5b6b230de5dcbfc3e02
parentd703ed11974c3b25b29c06a1180be050897df285
[libgens/tests] TestSuite: Reset errno after calling isatty().

On POSIX-compliant systems, isatty() sets errno to either EINVAL or
ENOTTY if the specified fd is not a TTY. This can cause problems
later, so reset errno to 0 afterwards.

test_VdpPalette_DAC.cpp::parse_number(): Reset errno to 0 before
calling strtol(), since strtol() only sets errno if an error occurred;
it won't clear errno if no error occurred.

This fixes an issue where the DAC tests didn't run properly when
run using CTest (e.g. 'make test') due to the changes required
for color text output on Windows.

This is a regression from commit 81e684d91685661d09b354c2174167f429970ffe.
([libgens/tests] TestSuite: Added color support on Windows.)
src/libgens/tests/TestSuite.cpp
src/libgens/tests/test_VdpPalette_DAC.cpp