diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rwxr-xr-x | tests/misc/tr | 205 | ||||
-rw-r--r-- | tests/tr/TODO | 1 | ||||
-rw-r--r-- | tests/tr/Test.pm | 168 | ||||
-rw-r--r-- | tests/tr/failures | 36 |
6 files changed, 207 insertions, 207 deletions
diff --git a/configure.ac b/configure.ac index 3362230e2..0bf33621a 100644 --- a/configure.ac +++ b/configure.ac @@ -353,6 +353,5 @@ AC_CONFIG_FILES( tests/tac/Makefile tests/tail/Makefile tests/test/Makefile - tests/tr/Makefile ) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am index daf2e5a9f..a23d830d0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -23,7 +23,7 @@ EXTRA_DIST = \ ## N O T E :: Do not add more names to this list. ## N O T E :: Even these are expected to go away. -SUBDIRS = join pr sort tac tail test tr +SUBDIRS = join pr sort tac tail test root_tests = \ chown/basic \ @@ -208,6 +208,7 @@ TESTS = \ misc/tee \ misc/tee-dash \ misc/test-diag \ + misc/tr \ misc/tsort \ misc/tty-eof \ misc/unexpand \ diff --git a/tests/misc/tr b/tests/misc/tr new file mode 100755 index 000000000..76fdc885e --- /dev/null +++ b/tests/misc/tr @@ -0,0 +1,205 @@ +#!/bin/sh +# -*- perl -*- + +# Copyright (C) 2008 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or 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, see <http://www.gnu.org/licenses/>. + +: ${top_srcdir=../..} +. $top_srcdir/tests/require-perl + +me=`echo $0|sed 's,.*/,,'` +exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF +require 5.003; +use strict; + +my $prog = 'tr'; + +# Turn off localization of executable's output. +@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + +my $map_all_to_1 = + "$prog: when translating with complemented character classes,\n" + . "string2 must map all characters in the domain to one\n"; + +my @Tests = +( + ['1', qw(abcd '[]*]'), {IN=>'abcd'}, {OUT=>']]]]'}], + ['2', qw(abc '[%*]xyz'), {IN=>'abc'}, {OUT=>'xyz'}], + ['3', qw('' '[.*]'), {IN=>'abc'}, {OUT=>'abc'}], + + # Test --truncate-set1 behavior when string1 is longer than string2 + ['4', qw(-t abcd xy), {IN=>'abcde'}, {OUT=>'xycde'}], + # Test bsd behavior (the default) when string1 is longer than string2 + ['5', qw(abcd xy), {IN=>'abcde'}, {OUT=>'xyyye'}], + # Do it the posix way + ['6', qw(abcd 'x[y*]'), {IN=>'abcde'}, {OUT=>'xyyye'}], + ['7', qw(-s a-p '%[.*]$'), {IN=>'abcdefghijklmnop'}, {OUT=>'%.$'}], + ['8', qw(-s a-p '[.*]$'), {IN=>'abcdefghijklmnop'}, {OUT=>'.$'}], + ['9', qw(-s a-p '%[.*]'), {IN=>'abcdefghijklmnop'}, {OUT=>'%.'}], + ['a', qw(-s '[a-z]'), {IN=>'aabbcc'}, {OUT=>'abc'}], + ['b', qw(-s '[a-c]'), {IN=>'aabbcc'}, {OUT=>'abc'}], + ['c', qw(-s '[a-b]'), {IN=>'aabbcc'}, {OUT=>'abcc'}], + ['d', qw(-s '[b-c]'), {IN=>'aabbcc'}, {OUT=>'aabc'}], + ['e', qw(-s '[\0-\5]'), + {IN=>"\0\0a\1\1b\2\2\2c\3\3\3d\4\4\4\4e\5\5"}, {OUT=>"\0a\1b\2c\3d\4e\5"}], + # tests of delete + ['f', qw(-d '[=[=]'), {IN=>'[[[[[[[]]]]]]]]'}, {OUT=>']]]]]]]]'}], + ['g', qw(-d '[=]=]'), {IN=>'[[[[[[[]]]]]]]]'}, {OUT=>'[[[[[[['}], + ['h', qw(-d '[:xdigit:]'), {IN=>'0123456789acbdefABCDEF'}, {OUT=>''}], + ['i', qw(-d '[:xdigit:]'), {IN=>'w0x1y2z3456789acbdefABCDEFz'}, + {OUT=>'wxyzz'}], + ['j', qw(-d '[:digit:]'), {IN=>'0123456789'}, {OUT=>''}], + ['k', qw(-d '[:digit:]'), {IN=>'a0b1c2d3e4f5g6h7i8j9k'}, {OUT=>'abcdefghijk'}], + ['l', qw(-d '[:lower:]'), {IN=>'abcdefghijklmnopqrstuvwxyz'}, {OUT=>''}], + ['m', qw(-d '[:upper:]'), {IN=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}], + ['n', qw(-d '[:lower:][:upper:]'), + {IN=>'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}], + ['o', qw(-d '[:alpha:]'), + {IN=>'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}], + ['p', qw(-d '[:alnum:]'), + {IN=>'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'}, + {OUT=>''}], + ['q', qw(-d '[:alnum:]'), + {IN=>'.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'}, + {OUT=>'..'}], + ['r', qw(-ds '[:alnum:]' .), + {IN=>'.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'}, + {OUT=>'.'}], + + # The classic example, with string2 BSD-style + ['s', qw(-cs '[:alnum:]' '\n'), + {IN=>'The big black fox jumped over the fence.'}, + {OUT=>"The\nbig\nblack\nfox\njumped\nover\nthe\nfence\n"}], + + # The classic example, POSIX-style + ['t', qw(-cs '[:alnum:]' '[\n*]'), + {IN=>'The big black fox jumped over the fence.'}, + {OUT=>"The\nbig\nblack\nfox\njumped\nover\nthe\nfence\n"}], + ['u', qw(-ds b a), {IN=>'aabbaa'}, {OUT=>'a'}], + ['v', qw(-ds '[:xdigit:]' Z), {IN=>'ZZ0123456789acbdefABCDEFZZ'}, {OUT=>'Z'}], + + # Try some data with 8th bit set in case something is mistakenly sign-extended. + ['w', qw(-ds '\350' '\345'), + {IN=>"\300\301\377\345\345\350\345"}, + {OUT=>"\300\301\377\345"}], + ['x', qw(-s abcdefghijklmn '[:*016]'), {IN=>'abcdefghijklmnop'}, {OUT=>':op'}], + ['y', qw(-d a-z), {IN=>'abc $code'}, {OUT=>' $'}], + ['z', qw(-ds a-z '$.'), {IN=>'a.b.c $$$$code\\'}, {OUT=>'. $\\'}], + + # Make sure that a-a is accepted. + ['range-a-a', qw(a-a z), {IN=>'abc'}, {OUT=>'zbc'}], + # + ['null', qw(a ''), {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>"$prog: when not truncating set1, string2 must be non-empty\n"}], + ['upcase', qw('[:lower:]' '[:upper:]'), + {IN=>'abcxyzABCXYZ'}, + {OUT=>'ABCXYZABCXYZ'}], + ['dncase', qw('[:upper:]' '[:lower:]'), + {IN=>'abcxyzABCXYZ'}, + {OUT=>'abcxyzabcxyz'}], + # + ['rep-cclass', qw('a[=*2][=c=]' xyyz), {IN=>'a=c'}, {OUT=>'xyz'}], + ['rep-1', qw('[:*3][:digit:]' a-m), {IN=>':1239'}, {OUT=>'cefgm'}], + ['rep-2', qw('a[b*512]c' '1[x*]2'), {IN=>'abc'}, {OUT=>'1x2'}], + ['rep-3', qw('a[b*513]c' '1[x*]2'), {IN=>'abc'}, {OUT=>'1x2'}], + # Another couple octal repeat count tests. + ['o-rep-1', qw('[b*08]' '[x*]'), {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>"$prog: invalid repeat count `08' in [c*n] construct\n"}], + ['o-rep-2', qw('[b*010]cd' '[a*7]BC[x*]'), {IN=>'bcd'}, {OUT=>'BCx'}], + + ['esc', qw('a\-z' A-Z), {IN=>'abc-z'}, {OUT=>'AbcBC'}], + ['bs-055', qw('a\055b' def), {IN=>"a\055b"}, {OUT=>'def'}], + ['bs-at-end', qw('\\' x), {IN=>"\\"}, {OUT=>'x'}, + {ERR=>"$prog: warning: an unescaped backslash at end of " + . "string is not portable\n"}], + + # + # From Ross + ['ross-0a', qw(-cs '[:upper:]' 'X[Y*]'), {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>$map_all_to_1}], + ['ross-0b', qw(-cs '[:cntrl:]' 'X[Y*]'), {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>$map_all_to_1}], + ['ross-1a', qw(-cs '[:upper:]' '[X*]'), + {IN=>'AMZamz123.-+AMZ'}, {OUT=>'AMZXAMZ'}], + ['ross-1b', qw(-cs '[:upper:][:digit:]' '[Z*]'), {IN=>''}, {OUT=>''}], + ['ross-2', qw(-dcs '[:lower:]' n-rs-z), + {IN=>'amzAMZ123.-+amz'}, {OUT=>'amzamz'}], + ['ross-3', qw(-ds '[:xdigit:]' '[:alnum:]'), + {IN=>'.ZABCDEFGzabcdefg.0123456788899.GG'}, {OUT=>'.ZGzg..G'}], + ['ross-4', qw(-dcs '[:alnum:]' '[:digit:]'), {IN=>''}, {OUT=>''}], + ['ross-5', qw(-dc '[:lower:]'), {IN=>''}, {OUT=>''}], + ['ross-6', qw(-dc '[:upper:]'), {IN=>''}, {OUT=>''}], + + # Ensure that these fail. + # Prior to 2.0.20, each would evoke a failed assertion. + ['empty-eq', qw('[==]' x), {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>"$prog: missing equivalence class character `[==]'\n"}], + ['empty-cc', qw('[::]' x), {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>"$prog: missing character class name `[::]'\n"}], + + # Weird repeat counts. + ['repeat-bs-9', qw(abc '[b*\9]'), {IN=>'abcd'}, {OUT=>'[b*d'}], + ['repeat-0', qw(abc '[b*0]'), {IN=>'abcd'}, {OUT=>'bbbd'}], + ['repeat-zeros', qw(abc '[b*00000000000000000000]'), + {IN=>'abcd'}, {OUT=>'bbbd'}], + ['repeat-compl', qw(-c '[a*65536]\n' '[b*]'), {IN=>'abcd'}, {OUT=>'abbb'}], + ['repeat-xC', qw(-C '[a*65536]\n' '[b*]'), {IN=>'abcd'}, {OUT=>'abbb'}], + + # From Glenn Fowler. + ['fowler-1', qw(ah -H), {IN=>'aha'}, {OUT=>'-H-'}], + + # 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 +# remove the tests that provide file arguments and keep only the ones +# generated by triple_test (identifiable by their .r and .p suffixes). +@Tests = grep {$_->[0] =~ /\.[pr]$/} @Tests; + +my $save_temps = $ENV{DEBUG}; +my $verbose = $ENV{VERBOSE}; + +my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose); +exit $fail; +EOF diff --git a/tests/tr/TODO b/tests/tr/TODO deleted file mode 100644 index e1cffb784..000000000 --- a/tests/tr/TODO +++ /dev/null @@ -1 +0,0 @@ -Integrate tests from the files `range-tests' and `failures'. diff --git a/tests/tr/Test.pm b/tests/tr/Test.pm deleted file mode 100644 index e92204f21..000000000 --- a/tests/tr/Test.pm +++ /dev/null @@ -1,168 +0,0 @@ -# Test "tr". - -# Copyright (C) 1996, 1997, 2000, 2002, 2004-2007 Free Software -# Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or 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, see <http://www.gnu.org/licenses/>. - -package Test; -require 5.002; -use strict; - -$Test::input_via_stdin = 1; - -my @tv = ( -# test flags 1 or 2 strings input expected output expected return code -# -['1', q|'abcd' '[]*]'|, 'abcd', ']]]]', 0], -['2', q|'abc' '[%*]xyz'|, 'abc', 'xyz', 0], -['3', q|'' '[.*]'|, 'abc', 'abc', 0], -# Test --truncate-set1 behavior when string1 is longer than string2 -['4', '-t ' . q|'abcd' 'xy'|, 'abcde', 'xycde', 0], -# Test bsd behavior (the default) when string1 is longer than string2 -['5', q|'abcd' 'xy'|, 'abcde', 'xyyye', 0], -# Do it the posix way -['6', q|'abcd' 'x[y*]'|, 'abcde', 'xyyye', 0], -# -['7', '-s ' . q|'a-p' '%[.*]$'|, 'abcdefghijklmnop', '%.$', 0], -['8', '-s ' . q|'a-p' '[.*]$'|, 'abcdefghijklmnop', '.$', 0], -['9', '-s ' . q|'a-p' '%[.*]'|, 'abcdefghijklmnop', '%.', 0], -['a', '-s ' . q|'[a-z]'|, 'aabbcc', 'abc', 0], -['b', '-s ' . q|'[a-c]'|, 'aabbcc', 'abc', 0], -['c', '-s ' . q|'[a-b]'|, 'aabbcc', 'abcc', 0], -['d', '-s ' . q|'[b-c]'|, 'aabbcc', 'aabc', 0], -['e', '-s ' . q|'[\0-\5]'|, - "\0\0a\1\1b\2\2\2c\3\3\3d\4\4\4\4e\5\5", - "\0a\1b\2c\3d\4e\5", 0], -# tests of delete -['f', '-d ' . q|'[=[=]'|, '[[[[[[[]]]]]]]]', ']]]]]]]]', 0], -['g', '-d ' . q|'[=]=]'|, '[[[[[[[]]]]]]]]', '[[[[[[[', 0], -['h', '-d ' . q|'[:xdigit:]'|, '0123456789acbdefABCDEF', '', 0], -['i', '-d ' . q|'[:xdigit:]'|, 'w0x1y2z3456789acbdefABCDEFz', 'wxyzz', 0], -['j', '-d ' . q|'[:digit:]'|, '0123456789', '', 0], -['k', '-d ' . q|'[:digit:]'|, 'a0b1c2d3e4f5g6h7i8j9k', 'abcdefghijk', 0], -['l', '-d ' . q|'[:lower:]'|, 'abcdefghijklmnopqrstuvwxyz', '', 0], -['m', '-d ' . q|'[:upper:]'|, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '', 0], -['n', '-d ' . q|'[:lower:][:upper:]'|, - 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', '', 0], -['o', '-d ' . q|'[:alpha:]'|, - 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', '', 0], -['p', '-d ' . q|'[:alnum:]'|, - 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', '', 0], -['q', '-d ' . q|'[:alnum:]'|, - '.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.', '..', 0], -['r', '-ds ' . q|'[:alnum:]' '.'|, - '.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.', '.', 0], - -# The classic example, with string2 BSD-style -['s', '-cs ' . q|'[:alnum:]' '\n'|, - 'The big black fox jumped over the fence.', - "The\nbig\nblack\nfox\njumped\nover\nthe\nfence\n", 0], - -# The classic example, POSIX-style -['t', '-cs ' . q|'[:alnum:]' '[\n*]'|, - 'The big black fox jumped over the fence.', - "The\nbig\nblack\nfox\njumped\nover\nthe\nfence\n", 0], -['u', '-ds ' . q|'b' 'a'|, 'aabbaa', 'a', 0], -['v', '-ds ' . q|'[:xdigit:]' 'Z'|, - 'ZZ0123456789acbdefABCDEFZZ', 'Z', 0], - -# Try some data with 8th bit set in case something is mistakenly sign-extended. -['w', '-ds ' . q|'\350' '\345'|, - "\300\301\377\345\345\350\345", - "\300\301\377\345", 0], -['x', '-s ' . q|'abcdefghijklmn' '[:*016]'|, 'abcdefghijklmnop', ':op', 0], -['y', '-d ' . q|'a-z'|, 'abc $code', ' $', 0], -['z', '-ds ' . q|'a-z' '$.'|, 'a.b.c $$$$code\\', '. $\\', 0], - -# Make sure that a-a is accepted. -['range-a-a', q|'a-a' 'z'|, 'abc', 'zbc', 0], -# -['null', q|'a' ''''|, '', '', 1], -['upcase',q|'[:lower:]' '[:upper:]'|, 'abcxyzABCXYZ', 'ABCXYZABCXYZ', 0], -['dncase', q|'[:upper:]' '[:lower:]'|, 'abcxyzABCXYZ', 'abcxyzabcxyz', 0], -# -['rep-cclass', q|'a[=*2][=c=]' 'xyyz'|, 'a=c', 'xyz', 0], -['rep-1', q|'[:*3][:digit:]' 'a-m'|, ':1239', 'cefgm', 0], -['rep-2', q|'a[b*512]c' '1[x*]2'|, 'abc', '1x2', 0], -['rep-3', q|'a[b*513]c' '1[x*]2'|, 'abc', '1x2', 0], -# Another couple octal repeat count tests. -['o-rep-1', q|'[b*08]' '[x*]'|, '', '', 1], -['o-rep-2', q|'[b*010]cd' '[a*7]BC[x*]'|, 'bcd', 'BCx', 0], - -['esc', q|'a\-z' 'A-Z'|, 'abc-z', 'AbcBC', 0], -['bs-055', q|'a\055b' def|, "a\055b", 'def', 0], -['bs-at-end', q|'\' x|, "\\", 'x', 0], - -# -# From Ross -['ross-0a', '-cs ' . q|'[:upper:]' 'X[Y*]'|, '', '', 1], -['ross-0b', '-cs ' . q|'[:cntrl:]' 'X[Y*]'|, '', '', 1], -['ross-1a', '-cs ' . q|'[:upper:]' '[X*]'|, 'AMZamz123.-+AMZ', 'AMZXAMZ', 0], -['ross-1b', '-cs ' . q|'[:upper:][:digit:]' '[Z*]'|, '', '', 0], -['ross-2', '-dcs ' . q|'[:lower:]' 'n-rs-z'|, 'amzAMZ123.-+amz', 'amzamz', 0], -['ross-3', '-ds ' . q|'[:xdigit:]' '[:alnum:]'|, - '.ZABCDEFGzabcdefg.0123456788899.GG', '.ZGzg..G', 0], -['ross-4', '-dcs ' . q|'[:alnum:]' '[:digit:]'|, '', '', 0], -['ross-5', '-dc ' . q|'[:lower:]'|, '', '', 0], -['ross-6', '-dc ' . q|'[:upper:]'|, '', '', 0], - -# Ensure that these fail. -# Prior to 2.0.20, each would evoke a failed assertion. -['empty-eq', q|'[==]' x|, '', '', 1], -['empty-cc', q|'[::]' x|, '', '', 1], - -# Weird repeat counts. -['repeat-bs-9', q|abc '[b*\9]'|, 'abcd', '[b*d', 0], -['repeat-0', q|abc '[b*0]'|, 'abcd', 'bbbd', 0], -['repeat-zeros', q|abc '[b*00000000000000000000]'|, 'abcd', 'bbbd', 0], -['repeat-compl', '-c ' . q|'[a*65536]\n' '[b*]'|, 'abcd', 'abbb', 0], -['repeat-xC', '-C ' . q|'[a*65536]\n' '[b*]'|, 'abcd', 'abbb', 0], - -# From Glenn Fowler. -['fowler-1', q|ah -H|, 'aha', '-H-', 0], - -# Up to coreutils-6.9, this would provoke a failed assertion. -['no-abort-1', '-c ' . q|a '[b*256]'|, 'abc', 'abb', 0], - -# Up to coreutils-6.9, tr rejected an unmatched [:lower:] or [:upper:] in SET1. -['s1-lower', q|'[:lower:]' '[.*]'|, '#$%123abcABC', '#$%123...ABC', 0], -['s1-upper', q|'[:upper:]' '[.*]'|, '#$%123abcABC', '#$%123abc...', 0], - -# 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',q|'[:upper:]' '[:lower:]'|, 'A', 'a', 0], - -# When doing a case-converting translation with something after the -# [:upper:] and [:lower:] elements, ensure that tr honors the following byte. -['upcase-xtra',q|'[:lower:].' '[:upper:]x'|, 'abc.', 'ABCx', 0], -['dncase-xtra',q|'[:upper:].' '[:lower:]x'|, 'ABC.', 'abcx', 0], -); - -$Test::env{'tolower-F'} = ['LC_CTYPE=en_US.ISO-8859-1']; - -sub test_vector -{ - my $t; - foreach $t (@tv) - { - my ($test_name, $flags, $in, $exp, $ret) = @$t; - $Test::input_via{$test_name} = {REDIR => 0, PIPE => 0}; - } - - return @tv; -} - -1; diff --git a/tests/tr/failures b/tests/tr/failures deleted file mode 100644 index e4278fa10..000000000 --- a/tests/tr/failures +++ /dev/null @@ -1,36 +0,0 @@ -# "tr" failures. - -# Copyright (C) 1993, 1994, 2006 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or 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, see <http://www.gnu.org/licenses/>. - -# ./tr a '[c*]b' -# ./tr -s abc zy -# ./tr abc zy -tr a '[:not-a-class:]' < /dev/null -tr a '[:digit:]' < /dev/null -tr '[c*]' k < /dev/null -tr a '[=c=]' < /dev/null -tr a '[c*][c*]' < /dev/null -tr -ds abd '[c*]' < /dev/null -tr -c '[:lower:]' '[:upper:]' < /dev/null -tr '[:lower:]' '[:lower:]' < /dev/null -tr '0-9[:lower:]' '[:upper:]' < /dev/null -tr a '' < /dev/null -tr -s '\432' < /dev/null -tr a 'abc\' < /dev/null -tr a '\x' < /dev/null -tr -s < /dev/null - -# And make sure tr does the right thing when POSIXLY_... is set. |