*** empty log message ***
[coreutils.git] / tests / misc / paste-no-nl
blob8085759be3cd497776ce9b4602e8fb9586998793
1 #!/bin/sh
2 # -*- perl -*-
3 # Ensure that paste properly handles files lacking a final newline.
5 : ${PERL=perl}
6 : ${srcdir=.}
8 $PERL -e 1 > /dev/null 2>&1 || {
9 echo 1>&2 "$0: configure didn't find a usable version of Perl," \
10 "so can't run this test"
11 exit 77
14 exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF
16 require 5.003;
17 use strict;
19 (my $program_name = $0) =~ s|.*/||;
21 $ENV{PROG} = 'paste';
23 # Turn off localization of executable's ouput.
24 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
26 my @Tests =
28 ['no-nl-1', {IN=>"a"}, {IN=>"b"}, {OUT=>"a\tb\n"}],
29 ['no-nl-2', {IN=>"a\n"}, {IN=>"b"}, {OUT=>"a\tb\n"}],
30 ['no-nl-3', {IN=>"a"}, {IN=>"b\n"}, {OUT=>"a\tb\n"}],
31 ['no-nl-4', {IN=>"a\n"}, {IN=>"b\n"}, {OUT=>"a\tb\n"}],
33 # Same as above, but with a two lines in each input file and
34 # the addition of the -d option to make SPACE be the output delimiter.
35 ['no-nla1', '-d" "', {IN=>"1\na"}, {IN=>"2\nb"}, {OUT=>"1 2\na b\n"}],
36 ['no-nla2', '-d" "', {IN=>"1\na\n"}, {IN=>"2\nb"}, {OUT=>"1 2\na b\n"}],
37 ['no-nla3', '-d" "', {IN=>"1\na"}, {IN=>"2\nb\n"}, {OUT=>"1 2\na b\n"}],
38 ['no-nla4', '-d" "', {IN=>"1\na\n"}, {IN=>"2\nb\n"}, {OUT=>"1 2\na b\n"}],
41 my $save_temps = $ENV{DEBUG};
42 my $verbose = $ENV{VERBOSE};
44 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
45 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
46 exit $fail;
47 EOF