direct mode unit tests: allow init failure

pull/632/head
nick black 4 years ago
parent 49fb03655e
commit 3a7ee4b757
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,31 +1,31 @@
#include "main.h"
TEST_CASE("DirectMode") {
// common initialization
if(getenv("TERM") == nullptr){
struct ncdirect* nc_ = ncdirect_init(NULL, stderr);
if(!nc_){
return;
}
FILE* outfp_ = fopen("/dev/tty", "wb");
REQUIRE(nullptr != outfp_);
struct ncdirect* nc_ = ncdirect_init(NULL, outfp_);
REQUIRE(nullptr != nc_);
SUBCASE("SetItalic") {
CHECK(0 == ncdirect_styles_set(nc_, NCSTYLE_ITALIC));
printf("DirectMode *italic*!\n");
fflush(stdout);
CHECK(0 == ncdirect_styles_off(nc_, NCSTYLE_ITALIC));
}
SUBCASE("SetBold") {
CHECK(0 == ncdirect_styles_set(nc_, NCSTYLE_BOLD));
printf("DirectMode *bold*!\n");
fflush(stdout);
CHECK(0 == ncdirect_styles_off(nc_, NCSTYLE_BOLD));
}
SUBCASE("SetUnderline") {
CHECK(0 == ncdirect_styles_set(nc_, NCSTYLE_UNDERLINE));
printf("DirectMode *underline*!\n");
fflush(stdout);
CHECK(0 == ncdirect_styles_off(nc_, NCSTYLE_UNDERLINE));
}
// common teardown
CHECK(0 == ncdirect_stop(nc_));
CHECK(0 == fclose(outfp_));
}

Loading…
Cancel
Save