ncpp unit tests: check get_instance exception #538

This commit is contained in:
nick black 2020-05-20 18:36:25 -04:00
parent f120ab883f
commit 7af027b895
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
5 changed files with 15 additions and 5 deletions

View File

@ -555,7 +555,7 @@ target_include_directories(notcurses-tester
)
target_link_libraries(notcurses-tester
PRIVATE
notcurses
notcurses++
"${TERMINFO_LIBRARIES}"
)
target_compile_definitions(notcurses-tester

10
tests/exceptions.cpp Normal file
View File

@ -0,0 +1,10 @@
#define NCPP_EXCEPTIONS_PLEASE
#include "main.h"
TEST_CASE("Exceptions") {
SUBCASE("Notcurses") {
CHECK_THROWS_AS(ncpp::NotCurses::get_instance(), ncpp::invalid_state_error);
}
}

View File

@ -1,6 +1,5 @@
#include <array>
#include <cstdlib>
#include "internal.h"
#include "main.h"
TEST_CASE("Fills") {

View File

@ -1,4 +1,5 @@
#define DOCTEST_CONFIG_IMPLEMENT
#include "main.h"
#include <term.h>
#include <fcntl.h>
#include <clocale>
@ -9,8 +10,6 @@
#include <termios.h>
#include <filesystem>
#include <langinfo.h>
#include "version.h"
#include "main.h"
static const char* datadir = NOTCURSES_SHARE;

View File

@ -2,9 +2,11 @@
#define NOTCURSES_TEST_MAIN
#include <unistd.h>
#include <doctest/doctest.h>
#include "version.h"
#include <doctest/doctest.h>
#include <notcurses/notcurses.h>
#include <ncpp/NotCurses.hh>
#include "internal.h"
auto find_data(const char* datum) -> char*;
auto enforce_utf8() -> bool;