summaryrefslogtreecommitdiff
path: root/tests/misc/tr
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-09-27 07:16:44 +0100
committerPádraig Brady <P@draigBrady.com>2010-09-29 11:05:12 +0100
commit3f48829c2939e53c7e961a42d0749765dc076279 (patch)
tree094154a9b97b0ee973440a915f9fc67474b3c796 /tests/misc/tr
parent704eedab034e24814067c535d3577f165c9a8b68 (diff)
downloadcoreutils-3f48829c2939e53c7e961a42d0749765dc076279.tar.xz
tr: fix various issues with case conversion
This valid translation spec aborted: LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_' This invalid translation spec aborted: LC_ALL=en_US.iso-8859-1 tr '[:upper:] ' '[:lower:]' This was caused by commit 6efd1046, 05-01-2008, "Avoid tr case-conversion failure in some locales" This misaligned conversion spec was allowed: LC_ALL=C tr 'A-Y[:lower:]' 'a-z[:upper:]' This was caused by commit af5d0c36, 21-10-2007, "tr: do not reject an unmatched [:lower:] or [:upper:] in SET1" This misaligned spec was allowed by extending the class: LC_ALL=C tr '[:upper:] ' '[:lower:]' * src/tr.c (validate_case_classes): A new function to check alignment of case conversion classes. Also it adjusts the length of the sets so that locales with different numbers of upper and lower case characters, don't cause issues. (string2_extend): Disallow extending the case conversion class as in the above example. That is locale dependent and most likely not what the user wants. (validate): Do the simple test for "restricted" char classes earlier, so we don't redundantly do more expensive validation. (main): Remove the case class validation, and simplify. * tests/misc/tr-case-class: A new test to test the various alignment and locale issues, associated with case conversion. * tests/misc/tr: Move case conversion tests to new tr-case-class. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fixes.
Diffstat (limited to 'tests/misc/tr')
-rwxr-xr-xtests/misc/tr26
1 files changed, 0 insertions, 26 deletions
diff --git a/tests/misc/tr b/tests/misc/tr
index ca7a960bb..00cd8e62c 100755
--- a/tests/misc/tr
+++ b/tests/misc/tr
@@ -155,34 +155,8 @@ my @Tests =
# Up to coreutils-6.9, this would provoke a failed assertion.
['no-abort-1', qw(-c a '[b*256]'), {IN=>'abc'}, {OUT=>'abb'}],
-
- # Up to coreutils-6.9, tr rejected an unmatched [:lower:] or [:upper:] in SET1.
- ['s1-lower', qw('[:lower:]' '[.*]'),
- {IN=>'#$%123abcABC'}, {OUT=>'#$%123...ABC'}],
- ['s1-upper', qw('[:upper:]' '[.*]'),
- {IN=>'#$%123abcABC'}, {OUT=>'#$%123abc...'}],
-
- # Up to coreutils-6.9.91, this would fail with the diagnostic:
- # tr: misaligned [:upper:] and/or [:lower:] construct
- # with LC_CTYPE=en_US.ISO-8859-1.
- ['tolower-F', qw('[:upper:]' '[:lower:]'), {IN=>'A'}, {OUT=>'a'}],
-
- # When doing a case-converting translation with something after the
- # [:upper:] and [:lower:] elements, ensure that tr honors the following byte.
- ['upcase-xtra', qw('[:lower:].' '[:upper:]x'), {IN=>'abc.'}, {OUT=>'ABCx'}],
- ['dncase-xtra', qw('[:upper:].' '[:lower:]x'), {IN=>'ABC.'}, {OUT=>'abcx'}],
);
-# Set LC_CTYPE=en_US.ISO-8859-1 in the environment of the tolower-F test.
-foreach my $t (@Tests)
- {
- if ($t->[0] eq 'tolower-F')
- {
- push @$t, {ENV=>'LC_CTYPE=en_US.ISO-8859-1'};
- last;
- }
- }
-
@Tests = triple_test \@Tests;
# tr takes its input only from stdin, not from a file argument, so