mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-06-23 11:12:05 +02:00
Count tab as whitespace in "empty shape" check #92
This commit is contained in:
parent
a02e241cfa
commit
ab9f123981
@ -201,7 +201,7 @@ int isempty(const sentry_t *shape)
|
|||||||
|
|
||||||
int isdeepempty(const sentry_t *shape)
|
int isdeepempty(const sentry_t *shape)
|
||||||
/*
|
/*
|
||||||
* Return true if shape is empty, also checking if lines consist of spaces
|
* Return true if shape is empty, also checking if lines consist of whitespace
|
||||||
* only.
|
* only.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
@ -215,7 +215,7 @@ int isdeepempty(const sentry_t *shape)
|
|||||||
|
|
||||||
for (j = 0; j < shape->height; ++j) {
|
for (j = 0; j < shape->height; ++j) {
|
||||||
if (shape->chars[j]) {
|
if (shape->chars[j]) {
|
||||||
if (strspn(shape->chars[j], " ") != shape->width) {
|
if (strspn(shape->chars[j], " \t") != shape->width) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
35
test/170_forbid_blank_box.cfg
Normal file
35
test/170_forbid_blank_box.cfg
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
BOX blank1
|
||||||
|
|
||||||
|
sample
|
||||||
|
(blank)
|
||||||
|
ends
|
||||||
|
|
||||||
|
shapes {
|
||||||
|
w (" ")
|
||||||
|
}
|
||||||
|
|
||||||
|
elastic (
|
||||||
|
w
|
||||||
|
)
|
||||||
|
|
||||||
|
END blank1
|
||||||
|
|
||||||
|
# -------------------------------------------------------
|
||||||
|
|
||||||
|
BOX blank2
|
||||||
|
|
||||||
|
sample
|
||||||
|
(blank)
|
||||||
|
ends
|
||||||
|
|
||||||
|
shapes {
|
||||||
|
w (" ", " ") # mix of tabs and spaces
|
||||||
|
e (" ", " ") # space only
|
||||||
|
s (" ", " ") # tab only
|
||||||
|
}
|
||||||
|
|
||||||
|
elastic (
|
||||||
|
w, e, s
|
||||||
|
)
|
||||||
|
|
||||||
|
END blank2
|
15
test/170_forbid_blank_box.txt
Normal file
15
test/170_forbid_blank_box.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
:DESC
|
||||||
|
Check that designs which consist only of whitespace are rejected.
|
||||||
|
|
||||||
|
:ARGS
|
||||||
|
-f 170_forbid_blank_box.cfg -l
|
||||||
|
:INPUT
|
||||||
|
:OUTPUT-FILTER
|
||||||
|
:EXPECTED-ERROR 1
|
||||||
|
boxes: 170_forbid_blank_box.cfg: line 9: must specify at least one non-empty shape per design
|
||||||
|
boxes: 170_forbid_blank_box.cfg: line 9: skipping to next design
|
||||||
|
boxes: 170_forbid_blank_box.cfg: line 29: must specify at least one non-empty shape per design
|
||||||
|
boxes: 170_forbid_blank_box.cfg: line 29: skipping to next design
|
||||||
|
boxes: no valid data in config file -- 170_forbid_blank_box.cfg
|
||||||
|
boxes: no valid designs found
|
||||||
|
:EOF
|
Loading…
x
Reference in New Issue
Block a user