diff options
author | Jim Meyering <jim@meyering.net> | 1998-12-06 23:01:12 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-12-06 23:01:12 +0000 |
commit | 9069b306dc8c9a1939c531adb3c70d5ee0718e45 (patch) | |
tree | 67393a37ac9723f7c3f5b2663b299dd044cc8900 /tests/ls-2 | |
parent | 76223aedefcef3a7f75349732ee4ba7b906f4496 (diff) | |
download | coreutils-9069b306dc8c9a1939c531adb3c70d5ee0718e45.tar.xz |
renamed from quote
Diffstat (limited to 'tests/ls-2')
-rwxr-xr-x | tests/ls-2/tests | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/ls-2/tests b/tests/ls-2/tests new file mode 100755 index 000000000..874689e7a --- /dev/null +++ b/tests/ls-2/tests @@ -0,0 +1,54 @@ +#!/bin/sh + +: ${PERL=perl} +: ${srcdir=.} + +case "$PERL" in + *'missing perl') + echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" + exit 77 + ;; +esac + +exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF +require 5.003; +use strict; + +(my $program_name = $0) =~ s|.*/||; + +# Turn off localisation of executable's ouput. +@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + +my $mkdir = {PRE => sub {mkdir 'd',0755 or die "d: $!\n"}}; +my $rmdir = {POST => sub {rmdir 'd' or die "d: $!\n"}}; + +my $q_bell = {IN => {"q\a" => ''}}; +my @Tests = + ( + # test-name options input expected-output + # + # quoting tests............................................ + ['q-', $q_bell, {OUT => "q\a\n"}, {EXIT => 0}], + ['q-N', '-N', $q_bell, {OUT => "q\a\n"}, {ERR => ''}], + ['q-q', '-q', $q_bell, {OUT => "q?\n"}], + ['q-Q', '-Q', $q_bell, {OUT => "\"q\\a\"\n"}], + + ['q-lit-q', '--quoting=literal -q', $q_bell, {OUT => "q?\n"}], + ['q-qs-lit', '--quoting=literal', $q_bell, {OUT => "q\a\n"}], + ['q-qs-sh', '--quoting=shell', $q_bell, {OUT => "q\a\n"}], + ['q-qs-sh-a', '--quoting=shell-always', $q_bell, {OUT => "'q\a'\n"}], + ['q-qs-c', '--quoting=c', $q_bell, {OUT => "\"q\\a\"\n"}], + ['q-qs-esc', '--quoting=escape', $q_bell, {OUT => "q\\a\n"}], + + ['emptydir', 'd', {OUT => ''}, $mkdir, $rmdir], + ['emptydir-x2', 'd d', {OUT => "d:\n\nd:\n"}, $mkdir, $rmdir], + ['emptydir-R', '-R d', {OUT => "d:\n"}, $mkdir, $rmdir], + ); + +my $save_temps = $ENV{SAVE_TEMPS}; +my $verbose = $ENV{VERBOSE}; + +my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n"; +my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); +exit $fail; +EOF |