4 # Copyright (C) 2008 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 . $top_srcdir/tests/require-perl
22 me=`echo $0|sed 's,.*/,,'`
23 exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
29 # Turn off localization of executable's output.
30 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
34 ['segfault', '-r', {IN=>"a\n"}, {IN=>"b\n"}, {OUT=>"a\nb\n"}],
35 ['segfault2','-r', {IN=>"a\nb\n"}, {IN=>"1\n2\n"}, {OUT=>"b\na\n2\n1\n"}],
37 ['basic-0', '', {IN=>""}, {OUT=>""}],
38 ['basic-a', '', {IN=>"a"}, {OUT=>"a"}],
39 ['basic-b', '', {IN=>"\n"}, {OUT=>"\n"}],
40 ['basic-c', '', {IN=>"a\n"}, {OUT=>"a\n"}],
41 ['basic-d', '', {IN=>"a\nb"}, {OUT=>"ba\n"}],
42 ['basic-e', '', {IN=>"a\nb\n"}, {OUT=>"b\na\n"}],
43 ['basic-f', '', {IN=>"1234567\n8\n"}, {OUT=>"8\n1234567\n"}],
44 ['basic-g', '', {IN=>"12345678\n9\n"}, {OUT=>"9\n12345678\n"}],
45 ['basic-h', '', {IN=>"123456\n8\n"}, {OUT=>"8\n123456\n"}],
46 ['basic-i', '', {IN=>"12345\n8\n"}, {OUT=>"8\n12345\n"}],
47 ['basic-j', '', {IN=>"1234\n8\n"}, {OUT=>"8\n1234\n"}],
48 ['basic-k', '', {IN=>"123\n8\n"}, {OUT=>"8\n123\n"}],
50 ['opt-b', '-b', {IN=>"\na\nb\nc"}, {OUT=>"\nc\nb\na"}],
51 ['opt-s', '-s:', {IN=>"a:b:c:"}, {OUT=>"c:b:a:"}],
52 ['opt-sb', qw(-s : -b), {IN=>":a:b:c"}, {OUT=>":c:b:a"}],
53 ['opt-r', qw(-r -s '\._+'),
54 {IN=>"1._2.__3.___4._"},
55 {OUT=>"4._3.___2.__1._"}],
57 ['opt-r2', qw(-r -s '\._+'),
58 {IN=>"a.___b.__1._2.__3.___4._"},
59 {OUT=>"4._3.___2.__1._b.__a.___"}],
61 # This gave incorrect output (.___4._2.__3._1) with tac-1.22.
62 ['opt-br', qw(-b -r -s '\._+'),
63 {IN=>"._1._2.__3.___4"}, {OUT=>".___4.__3._2._1"}],
65 ['opt-br2', qw(-b -r -s '\._+'),
66 {IN=>".__x.___y.____z._1._2.__3.___4"},
67 {OUT=>".___4.__3._2._1.____z.___y.__x"}],
70 @Tests = triple_test \@Tests;
72 my $save_temps = $ENV{DEBUG};
73 my $verbose = $ENV{VERBOSE};
75 my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);