Add test cases for colored unicode 'headline' design #1

This design uses complex regular expressions, which must work on unicode characters.
This commit is contained in:
Thomas Jensen 2021-02-10 22:14:09 +01:00
parent eb5ac9c701
commit 12fa4ea57e
No known key found for this signature in database
GPG Key ID: A4ACEE270D0FB7DB
4 changed files with 39 additions and 7 deletions

View File

@ -1883,8 +1883,7 @@ reverse "^ " to " "
reverse "((?:\x1b\[[0-9;]*m)*(?!\x1b).) " to "$1"
padding {
left 2
right 1
horizontal 2
}
elastic (n,e,s,w)

View File

@ -0,0 +1,10 @@
:ARGS
-n UTF-8 -d headline -p l3r1
:INPUT
   foo 海 bar
:OUTPUT-FILTER
:EXPECTED
/**************************/
/* f o o  海  b a r  */
/**************************/
:EOF

View File

@ -0,0 +1,16 @@
:DESC
Tests removal of a box of the 'headline' design from unicode text with ANSI color escapes added by lolcat.
Indentation is restored, by "coloring" of spaces is lost.
Indentation is correctly restored as 3 spaces, because we give -p, telling it what the requested padding was when the
box was created.
:ARGS
-d headline -p l3r2 -r
:INPUT
/**************************/
/* f o o  海  b a r  */
/**************************/
:OUTPUT-FILTER
:EXPECTED
foo 海 bar
:EOF

View File

@ -1,11 +1,18 @@
#!/usr/bin/env bash
#
# Low-tech test runner for boxes.
# boxes - Command line filter to draw/remove ASCII boxes around text
# Copyright (C) 1999 Thomas Jensen and the boxes contributors
#
# File: testrunner.sh
# Date created: September 23, 2014 (Tuesday, 20:06h)
# Author: Thomas Jensen
# _____________________________________________________________________
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License, version 2, as published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# _____________________________________________________________________________________________________________________
#
# Low-tech test runner for boxes.
# _____________________________________________________________________________________________________________________
if [ $# -ne 1 ]; then
echo 'Usage: testrunner.sh {-suite | <testCaseFile>}'