skip tests if no TERM is defined

This commit is contained in:
nick black 2019-11-18 20:57:33 -05:00
parent 908e9e120c
commit 231be96714
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 16 additions and 2 deletions

View File

@ -4,4 +4,10 @@
#include <gtest/gtest.h>
#include <notcurses.h>
// GTEST_SKIP only came along in GoogleTest 1.9
#ifndef GTEST_SKIP
#define GTEST_SKIP() return;
#endif
#endif

View File

@ -3,13 +3,21 @@
#include <notcurses.h>
#include "main.h"
TEST(Notcurses, BasicLifetime) {
class NotcursesTest : public :: testing::Test {
void SetUp() override {
if(getenv("TERM") == nullptr){
GTEST_SKIP();
}
}
};
TEST_F(NotcursesTest, BasicLifetime) {
struct notcurses* nc = notcurses_init();
ASSERT_NE(nullptr, nc);
EXPECT_EQ(0, notcurses_stop(nc));
}
TEST(Notcurses, TermDimensions) {
TEST_F(NotcursesTest, TermDimensions) {
struct notcurses* nc = notcurses_init();
int x, y;
ASSERT_NE(nullptr, nc);