menu test: work with older Clang

This commit is contained in:
nick black 2020-02-08 22:24:31 -05:00
parent 8d7e6482dd
commit 01d160f40b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -39,7 +39,7 @@ TEST_CASE("MenuTest") {
SUBCASE("EmptySectionReject") { SUBCASE("EmptySectionReject") {
struct ncmenu_options opts{}; struct ncmenu_options opts{};
struct ncmenu_section sections[] = { struct ncmenu_section sections[] = {
{ .name = strdup("Empty"), .itemcount = 0, .items = nullptr, .shortcut{}, }, { .name = strdup("Empty"), .itemcount = 0, .items = nullptr, .shortcut = ncinput(), },
}; };
opts.sections = sections; opts.sections = sections;
opts.sectioncount = sizeof(sections) / sizeof(*sections); opts.sectioncount = sizeof(sections) / sizeof(*sections);
@ -52,10 +52,10 @@ TEST_CASE("MenuTest") {
// a section with only separators ought be rejected // a section with only separators ought be rejected
SUBCASE("SeparatorSectionReject") { SUBCASE("SeparatorSectionReject") {
struct ncmenu_item empty_items[] = { struct ncmenu_item empty_items[] = {
{ .desc = nullptr, .shortcut = {}, }, { .desc = nullptr, .shortcut = ncinput(), },
}; };
struct ncmenu_section sections[] = { struct ncmenu_section sections[] = {
{ .name = strdup("Empty"), .itemcount = 1, .items = empty_items, .shortcut{}, }, { .name = strdup("Empty"), .itemcount = 1, .items = empty_items, .shortcut = ncinput(), },
}; };
struct ncmenu_options opts{}; struct ncmenu_options opts{};
opts.sections = sections; opts.sections = sections;
@ -68,10 +68,10 @@ TEST_CASE("MenuTest") {
SUBCASE("MenuOneSection") { SUBCASE("MenuOneSection") {
struct ncmenu_item file_items[] = { struct ncmenu_item file_items[] = {
{ .desc = strdup("I would like a new file"), .shortcut = {}, }, { .desc = strdup("I would like a new file"), .shortcut = ncinput(), },
}; };
struct ncmenu_section sections[] = { struct ncmenu_section sections[] = {
{ .name = strdup("File"), .itemcount = sizeof(file_items) / sizeof(*file_items), .items = file_items, .shortcut{}, }, { .name = strdup("File"), .itemcount = sizeof(file_items) / sizeof(*file_items), .items = file_items, .shortcut = ncinput(), },
}; };
struct ncmenu_options opts{}; struct ncmenu_options opts{};
opts.sections = sections; opts.sections = sections;
@ -85,10 +85,10 @@ TEST_CASE("MenuTest") {
// only one menu at a time per notcurses object // only one menu at a time per notcurses object
SUBCASE("RejectDoubleMenu") { SUBCASE("RejectDoubleMenu") {
struct ncmenu_item file_items[] = { struct ncmenu_item file_items[] = {
{ .desc = strdup("I would like a new file"), .shortcut = {}, }, { .desc = strdup("I would like a new file"), .shortcut = ncinput(), },
}; };
struct ncmenu_section sections[] = { struct ncmenu_section sections[] = {
{ .name = strdup("File"), .itemcount = sizeof(file_items) / sizeof(*file_items), .items = file_items, .shortcut{}, }, { .name = strdup("File"), .itemcount = sizeof(file_items) / sizeof(*file_items), .items = file_items, .shortcut = ncinput(), },
}; };
struct ncmenu_options opts{}; struct ncmenu_options opts{};
opts.sections = sections; opts.sections = sections;
@ -107,10 +107,10 @@ TEST_CASE("MenuTest") {
// don't call ncmenu_destroy(), invoking destruction in notcurses_stop() // don't call ncmenu_destroy(), invoking destruction in notcurses_stop()
SUBCASE("MenuNoFree") { SUBCASE("MenuNoFree") {
struct ncmenu_item file_items[] = { struct ncmenu_item file_items[] = {
{ .desc = strdup("I would like a new file"), .shortcut = {}, }, { .desc = strdup("I would like a new file"), .shortcut = ncinput(), },
}; };
struct ncmenu_section sections[] = { struct ncmenu_section sections[] = {
{ .name = strdup("File"), .itemcount = sizeof(file_items) / sizeof(*file_items), .items = file_items, .shortcut{}, }, { .name = strdup("File"), .itemcount = sizeof(file_items) / sizeof(*file_items), .items = file_items, .shortcut = ncinput(), },
}; };
struct ncmenu_options opts{}; struct ncmenu_options opts{};
opts.sections = sections; opts.sections = sections;
@ -122,14 +122,14 @@ TEST_CASE("MenuTest") {
SUBCASE("VeryLongMenu") { SUBCASE("VeryLongMenu") {
struct ncmenu_item items[] = { struct ncmenu_item items[] = {
{ .desc = strdup("Generic menu entry"), .shortcut = {}, }, { .desc = strdup("Generic menu entry"), .shortcut = ncinput(), },
}; };
struct ncmenu_section sections[] = { struct ncmenu_section sections[] = {
{ .name = strdup("antidisestablishmentarianism"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut{}, }, { .name = strdup("antidisestablishmentarianism"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut = ncinput(), },
{ .name = strdup("floccinaucinihilipilification"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut{}, }, { .name = strdup("floccinaucinihilipilification"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut = ncinput(), },
{ .name = strdup("pneumonoultramicroscopicsilicovolcanoconiosis"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut{}, }, { .name = strdup("pneumonoultramicroscopicsilicovolcanoconiosis"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut = ncinput(), },
{ .name = strdup("supercalifragilisticexpialidocious"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut{}, }, { .name = strdup("supercalifragilisticexpialidocious"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut = ncinput(), },
{ .name = strdup("Incomprehensibilities"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut{}, }, { .name = strdup("Incomprehensibilities"), .itemcount = sizeof(items) / sizeof(*items), .items = items, .shortcut = ncinput(), },
}; };
struct ncmenu_options opts{}; struct ncmenu_options opts{};
opts.sections = sections; opts.sections = sections;