Add tests for #835

Also add ErrnoGuard before `isatty` call, because apparently it can set
errno to 25 (ENOTTY).
This commit is contained in:
Martin Hořeňovský 2017-03-06 22:07:33 +01:00
parent 613e1466f9
commit ace70407a2
7 changed files with 92 additions and 12 deletions

View file

@ -16,6 +16,7 @@
#include "../include/internal/catch_xmlwriter.hpp"
#include <iostream>
#include <cerrno>
TEST_CASE( "random SECTION tests", "[.][sections][failing]" )
{
@ -393,3 +394,14 @@ TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" )
TEST_CASE( "# A test name that starts with a #" ) {
SUCCEED( "yay" );
}
static int f() {
return 1;
}
TEST_CASE( "#835 -- errno should not be touched by Catch" ) {
errno = 1;
CHECK(f() == 0);
REQUIRE(errno == 1); // Check that f() doesn't touch errno.
}