mirror of
https://github.com/ascii-boxes/boxes.git
synced 2024-12-04 22:11:07 +01:00
Add two more black-box tests for removal with fixes
This commit is contained in:
parent
602d91dd8b
commit
ba40638946
@ -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;
|
||||
|
11
test/188_design_not_detectable.txt
Normal file
11
test/188_design_not_detectable.txt
Normal 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
|
22
test/189_blank_lines_surrounding_box.txt
Normal file
22
test/189_blank_lines_surrounding_box.txt
Normal 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
|
Loading…
Reference in New Issue
Block a user