Add two more black-box tests for removal with fixes

This commit is contained in:
Thomas Jensen 2023-10-29 14:35:06 +01:00
parent 602d91dd8b
commit ba40638946
No known key found for this signature in database
GPG Key ID: A4ACEE270D0FB7DB
3 changed files with 38 additions and 3 deletions

View File

@ -730,11 +730,13 @@ static void match_vertical_side(remove_ctx_t *ctx, int vside, shape_line_ctx_t *
BFREE(to_free);
shape_text = NULL;
if (p == NULL) {
if ((p == NULL)
|| (vside == BLEF && ((size_t) (p - input_line) > input_indent + (max_quality - quality)))
|| (vside == BRIG && ((size_t) (p - input_line) < input_length - input_trailing - quality))) {
shape_text = shorten(*shape_line_ctx, &quality, vside == BLEF, 1, 1);
to_free = shape_text;
}
else if (vside == BLEF && ((size_t) (p - input_line) <= input_indent + (max_quality - quality))) {
else if (vside == BLEF) {
if (quality > line_ctx->west_quality) {
line_ctx->west_start = (size_t) (p - input_line);
line_ctx->west_end = line_ctx->west_start + quality;
@ -744,7 +746,7 @@ static void match_vertical_side(remove_ctx_t *ctx, int vside, shape_line_ctx_t *
break;
}
}
else if (vside == BRIG && ((size_t) (p - input_line) >= input_length - input_trailing - quality)) {
else if (vside == BRIG) {
if (quality > line_ctx->east_quality) {
line_ctx->east_start = (size_t) (p - input_line);
line_ctx->east_end = line_ctx->east_start + quality;

View File

@ -0,0 +1,11 @@
:DESC
Tests that a proper error message is produced when the box design cannot be detected.
:ARGS
-r
:INPUT
foo
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: Box design autodetection failed. Use -d option.
:EOF

View File

@ -0,0 +1,22 @@
:DESC
Blank lines above and below the box are retained when the box is removed.
There are some spaces in the line just above the box.
:ARGS
-r -d jstone
:INPUT
/*-------------+
| Lorem Ipsum |
+-------------*/
:OUTPUT-FILTER
:EXPECTED
Lorem Ipsum
:EOF