From fc7f881767825c28006c80e1352f0294c12df696 Mon Sep 17 00:00:00 2001 From: Thomas Jensen Date: Fri, 12 Feb 2021 22:14:37 +0100 Subject: [PATCH] Explicitly set UTF-8 charset in unicode test cases so that they don't fail on systems where UTF-8 is not properly set on the terminal #1 --- src/unicode.c | 1 + test/106_unicode_align_center.txt | 5 ++++- test/107_unicode_align_left_lolcat.txt | 2 +- test/108_unicode_align_center_lolcat.txt | 2 +- test/109_unicode_align_right_lolcat.txt | 2 +- test/110_unicode_align_complex_lolcat.txt | 2 +- test/117_unicode_ansi_mending.txt | 2 +- test/118_unicode_ansi_align_center.txt | 2 +- test/119_unicode_ansi_align_right.txt | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/unicode.c b/src/unicode.c index a827084..505e462 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -265,6 +265,7 @@ const char *check_encoding(const char *manual_encoding, const char *system_encod } fprintf(stderr, "%s: Invalid character encoding: %s - falling back to %s\n", PROJECT, manual_encoding, system_encoding); + fflush(stderr); } return system_encoding; } diff --git a/test/106_unicode_align_center.txt b/test/106_unicode_align_center.txt index 8bebf11..ca97d84 100644 --- a/test/106_unicode_align_center.txt +++ b/test/106_unicode_align_center.txt @@ -1,5 +1,8 @@ +:DESC +Test center alignment of unicode text without escape sequences mixed in, but with some chars in double-width +(chinese). We always set the charset manually because else the build would fail on systems which have it set wrong. :ARGS --ac +-n UTF-8 -ac :INPUT a ab diff --git a/test/107_unicode_align_left_lolcat.txt b/test/107_unicode_align_left_lolcat.txt index 78577f4..8e207f9 100644 --- a/test/107_unicode_align_left_lolcat.txt +++ b/test/107_unicode_align_left_lolcat.txt @@ -1,5 +1,5 @@ :ARGS --al +-n UTF-8 -al :INPUT          a      ab diff --git a/test/108_unicode_align_center_lolcat.txt b/test/108_unicode_align_center_lolcat.txt index 87dfc81..b58f6b0 100644 --- a/test/108_unicode_align_center_lolcat.txt +++ b/test/108_unicode_align_center_lolcat.txt @@ -1,5 +1,5 @@ :ARGS --ac +-n UTF-8 -ac :INPUT          a      ab diff --git a/test/109_unicode_align_right_lolcat.txt b/test/109_unicode_align_right_lolcat.txt index 799782a..313e461 100644 --- a/test/109_unicode_align_right_lolcat.txt +++ b/test/109_unicode_align_right_lolcat.txt @@ -1,5 +1,5 @@ :ARGS --ar +-n UTF-8 -ar :INPUT          a      ab diff --git a/test/110_unicode_align_complex_lolcat.txt b/test/110_unicode_align_complex_lolcat.txt index c8a792f..6ed6356 100644 --- a/test/110_unicode_align_complex_lolcat.txt +++ b/test/110_unicode_align_complex_lolcat.txt @@ -1,5 +1,5 @@ :ARGS --ahrvbjr -ph3 -sx26 +-n UTF-8 -ahrvbjr -ph3 -sx26 :INPUT          a      ab diff --git a/test/117_unicode_ansi_mending.txt b/test/117_unicode_ansi_mending.txt index 231a2fd..8413355 100644 --- a/test/117_unicode_ansi_mending.txt +++ b/test/117_unicode_ansi_mending.txt @@ -1,7 +1,7 @@ :DESC This test case checks that a broken box with unicode and ansi sequences can be properly mended. :ARGS --d diamonds -ac -m +-n UTF-8 -d diamonds -ac -m :INPUT /\ /\ /\ /\ /\//\\/\ /\//\\/\ /\//\\/\ /\//\\/\ diff --git a/test/118_unicode_ansi_align_center.txt b/test/118_unicode_ansi_align_center.txt index e36d0fd..8933b7f 100644 --- a/test/118_unicode_ansi_align_center.txt +++ b/test/118_unicode_ansi_align_center.txt @@ -1,7 +1,7 @@ :DESC Center align colored unicode text. :ARGS --d unicornsay -ac +-n UTF-8 -d unicornsay -ac :INPUT          試      常盤 diff --git a/test/119_unicode_ansi_align_right.txt b/test/119_unicode_ansi_align_right.txt index 15a3eaf..e74fc09 100644 --- a/test/119_unicode_ansi_align_right.txt +++ b/test/119_unicode_ansi_align_right.txt @@ -1,7 +1,7 @@ :DESC Right align colored unicode text. :ARGS --d unicornsay -ar +-n UTF-8 -d unicornsay -ar :INPUT          試      常盤