mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user