diff options
| author | Pádraig Brady <P@draigBrady.com> | 2025-08-27 14:34:46 +0100 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2025-08-27 16:41:07 +0100 |
| commit | 4b35a3b9201742ddff56062a13cf20ce4e9bc9be (patch) | |
| tree | 7eadeef6dedd5c57ac96e5b0487ca1b9abfe10e3 /tests | |
| parent | tests: fold: copy i18n patch tests (diff) | |
| download | coreutils-4b35a3b9201742ddff56062a13cf20ce4e9bc9be.tar.gz coreutils-4b35a3b9201742ddff56062a13cf20ce4e9bc9be.zip | |
tests: fold: add tests for multi-byte width
* tests/fold/fold.pl: The i18n patch didn't actually test folding
of multi-byte characters, so add tests for various multi-byte forms.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/fold/fold.pl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/fold/fold.pl b/tests/fold/fold.pl index de34177fd..ea9bc5c6a 100755 --- a/tests/fold/fold.pl +++ b/tests/fold/fold.pl @@ -50,12 +50,25 @@ my @Tests = {OUT=>"123456\n7890\nabcdef\nghij\n123456\n7890"}], ); +# define UTF-8 encoded multi-byte characters for tests +my $eaC = "\xC3\xA9"; # e acute NFC form +my $eaD = "\x65\xCC\x81"; # e acute NFD form (zero width combining) +my $eFW = "\xEF\xBD\x85"; # e fullwidth + +my @mbTests = + ( + ['smb1', '-w2', {IN=>$eaC x 3}, {OUT=>$eaC x 2 . "\n" . $eaC}], + ['smb2', '-w2', {IN=>$eaD x 3}, {OUT=>$eaD x 2 . "\n" . $eaD}], + ['smb3', '-w2', {IN=>$eFW x 2}, {OUT=>$eFW . "\n" . $eFW}], + ); + if ($mb_locale ne 'C') { # Duplicate each test vector, appending "-mb" to the test name and # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we # provide coverage for multi-byte code paths. my @new; + foreach my $t (@Tests) { my @new_t = @$t; @@ -64,6 +77,15 @@ if ($mb_locale ne 'C') push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; } push @Tests, @new; + + @new = (); + foreach my $t (@mbTests) + { + my @new_t = @$t; + + push @new, [@new_t, {ENV => "LC_ALL=$mb_locale"}]; + } + push @Tests, @new; } @Tests = triple_test \@Tests; |
