Skip to content

Commit

Permalink
[tests] add FamilyAbove for infinite loop found by drewt #2687
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Dec 10, 2022
1 parent f6d396e commit 5c34ff4
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/tests/zaxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ TEST_CASE("ZAxis") {
}

SUBCASE("FamilyBottom") {
struct ncplane_options nopts{};
ncplane_options nopts{};
nopts.rows = nopts.cols = 1;
auto a = ncplane_create(n_, &nopts);
REQUIRE(nullptr != a);
Expand Down Expand Up @@ -234,5 +234,22 @@ TEST_CASE("ZAxis") {
CHECK(ncpile_bottom(n_) == e);
}

// contributed by drewt on github, this led to an infinite loop
SUBCASE("FamilyAbove") {
ncplane_options nopts{};
nopts.rows = 1;
nopts.cols = 1;
struct ncplane *n = ncplane_create(notcurses_stdplane(nc_), &nopts);
struct ncplane *a = ncplane_create(n, &nopts);
struct ncplane *b = ncplane_create(n, &nopts);
struct ncplane *bpoint = ncplane_create(notcurses_stdplane(nc_), &nopts);
ncplane_move_family_above(n, bpoint);
ncplane_destroy(bpoint);
ncplane_destroy(b);
ncplane_destroy(a);
ncplane_destroy(n);
}

CHECK(0 == notcurses_stop(nc_));

}

0 comments on commit 5c34ff4

Please sign in to comment.