mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
notcurses-tester: run passing tests in C locale #325
This commit is contained in:
parent
7dae248a41
commit
d9bb9b03af
@ -2,6 +2,9 @@
|
|||||||
#include "egcpool.h"
|
#include "egcpool.h"
|
||||||
|
|
||||||
TEST_CASE("MultibyteWidth") {
|
TEST_CASE("MultibyteWidth") {
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
CHECK(0 == mbswidth("")); // zero bytes, zero columns
|
CHECK(0 == mbswidth("")); // zero bytes, zero columns
|
||||||
CHECK(-1 == mbswidth("\x7")); // single byte, non-printable
|
CHECK(-1 == mbswidth("\x7")); // single byte, non-printable
|
||||||
CHECK(1 == mbswidth(" ")); // single byte, one column
|
CHECK(1 == mbswidth(" ")); // single byte, one column
|
||||||
|
@ -12,6 +12,10 @@ TEST_CASE("EGCpool") {
|
|||||||
CHECK(!pool_.poolused);
|
CHECK(!pool_.poolused);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SUBCASE("UTF8EGC") {
|
SUBCASE("UTF8EGC") {
|
||||||
const char* wstr = "☢";
|
const char* wstr = "☢";
|
||||||
int c;
|
int c;
|
||||||
|
@ -7,6 +7,9 @@ TEST_CASE("Fills") {
|
|||||||
if(getenv("TERM") == nullptr){
|
if(getenv("TERM") == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
notcurses_options nopts{};
|
notcurses_options nopts{};
|
||||||
nopts.inhibit_alternate_screen = true;
|
nopts.inhibit_alternate_screen = true;
|
||||||
nopts.suppress_banner = true;
|
nopts.suppress_banner = true;
|
||||||
|
@ -86,9 +86,6 @@ auto main(int argc, const char **argv) -> int {
|
|||||||
std::cerr << "Coudln't set locale based on user preferences!" << std::endl;
|
std::cerr << "Coudln't set locale based on user preferences!" << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if(!enforce_utf8()){
|
|
||||||
return EXIT_SUCCESS; // hrmmm
|
|
||||||
}
|
|
||||||
doctest::Context context;
|
doctest::Context context;
|
||||||
|
|
||||||
context.setOption("order-by", "name"); // sort the test cases by their name
|
context.setOption("order-by", "name"); // sort the test cases by their name
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include <notcurses/notcurses.h>
|
#include <notcurses/notcurses.h>
|
||||||
|
|
||||||
char* find_data(const char* datum);
|
auto find_data(const char* datum) -> char*;
|
||||||
|
auto enforce_utf8() -> bool;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,6 +21,9 @@ TEST_CASE("NCPlane") {
|
|||||||
if(getenv("TERM") == nullptr){
|
if(getenv("TERM") == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
notcurses_options nopts{};
|
notcurses_options nopts{};
|
||||||
nopts.inhibit_alternate_screen = true;
|
nopts.inhibit_alternate_screen = true;
|
||||||
nopts.suppress_banner = true;
|
nopts.suppress_banner = true;
|
||||||
|
@ -7,6 +7,9 @@ TEST_CASE("Plot") {
|
|||||||
if(getenv("TERM") == nullptr){
|
if(getenv("TERM") == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
notcurses_options nopts{};
|
notcurses_options nopts{};
|
||||||
nopts.inhibit_alternate_screen = true;
|
nopts.inhibit_alternate_screen = true;
|
||||||
nopts.suppress_banner = true;
|
nopts.suppress_banner = true;
|
||||||
|
@ -34,7 +34,11 @@ TEST_CASE("Readers") {
|
|||||||
ncreader_options opts{};
|
ncreader_options opts{};
|
||||||
opts.physrows = dimy / 2;
|
opts.physrows = dimy / 2;
|
||||||
opts.physcols = dimx / 2;
|
opts.physcols = dimx / 2;
|
||||||
|
if(enforce_utf8()){
|
||||||
opts.egc = strdup("▒");
|
opts.egc = strdup("▒");
|
||||||
|
}else{
|
||||||
|
opts.egc = strdup("x");
|
||||||
|
}
|
||||||
auto nr = ncreader_create(n_, 0, 0, &opts);
|
auto nr = ncreader_create(n_, 0, 0, &opts);
|
||||||
REQUIRE(nullptr != nr);
|
REQUIRE(nullptr != nr);
|
||||||
channels_set_fg(&opts.echannels, 0xff44ff);
|
channels_set_fg(&opts.echannels, 0xff44ff);
|
||||||
|
@ -30,6 +30,9 @@ TEST_CASE("Rotate") {
|
|||||||
if(getenv("TERM") == nullptr){
|
if(getenv("TERM") == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
notcurses_options nopts{};
|
notcurses_options nopts{};
|
||||||
nopts.inhibit_alternate_screen = true;
|
nopts.inhibit_alternate_screen = true;
|
||||||
nopts.suppress_banner = true;
|
nopts.suppress_banner = true;
|
||||||
|
@ -5,6 +5,9 @@ TEST_CASE("Multimedia") {
|
|||||||
if(getenv("TERM") == nullptr){
|
if(getenv("TERM") == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
notcurses_options nopts{};
|
notcurses_options nopts{};
|
||||||
nopts.inhibit_alternate_screen = true;
|
nopts.inhibit_alternate_screen = true;
|
||||||
nopts.suppress_banner = true;
|
nopts.suppress_banner = true;
|
||||||
|
@ -7,6 +7,9 @@ TEST_CASE("Wide") {
|
|||||||
if(getenv("TERM") == nullptr){
|
if(getenv("TERM") == nullptr){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!enforce_utf8()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
notcurses_options nopts{};
|
notcurses_options nopts{};
|
||||||
nopts.inhibit_alternate_screen = true;
|
nopts.inhibit_alternate_screen = true;
|
||||||
nopts.suppress_banner = true;
|
nopts.suppress_banner = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user