summaryrefslogtreecommitdiff
path: root/tests/ls-2
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-08-15 18:40:41 +0000
committerJim Meyering <jim@meyering.net>1998-08-15 18:40:41 +0000
commitdc8cd6e39a81858161ab2cdb28f01b4ea638c61f (patch)
tree6553b4358385c999355508abf3d3a279a243b18e /tests/ls-2
parent6db0107e71ae0268e1c552c08f739bbb118f2d69 (diff)
downloadcoreutils-dc8cd6e39a81858161ab2cdb28f01b4ea638c61f.tar.xz
.
Diffstat (limited to 'tests/ls-2')
-rwxr-xr-xtests/ls-2/quoting48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/ls-2/quoting b/tests/ls-2/quoting
new file mode 100755
index 000000000..398ce118c
--- /dev/null
+++ b/tests/ls-2/quoting
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+require 5.003;
+use strict;
+
+my $program_name;
+($program_name = $0) =~ s|.*/||;
+
+# INPUTs
+# ['contents'] contents only (file name is derived from test name)
+# [{filename => 'contents'}] filename and contents
+# [{filename => undef}] filename only -- $(srcdir)/filename must exist
+# (FIXME: note to self: get $srcdir from ENV)
+# The file names from the inputs are concatenated in order on the command line
+# FIXME: If there is more than one input file, the you can't specify REDIRECT.
+# PIPE is still ok.
+#
+# OUTPUTs (always hash refs)
+# {OUT => "data"} put data in a temp file and compare it to stdout from cmd
+# {OUT => ["filename"]} compare contents of existing filename to stdout from cmd
+# Ditto for `ERR', but compare with stderr
+# {EXIT => N} expect exit status of cmd to be N
+#
+# The OUT-keyed hash ref is the only one that's required.
+# If the ERR-keyed one is omitted, then expect stderr to be empty.
+# If the EXIT-keyed one is omitted, then expect exit status to be zero.
+
+my @Tests =
+ (
+ # test-name options input expected-output
+ #
+ ['q-', [{"q\a" => ''}], {OUT => "q\a\n"}],
+ ['q-N', '-N', [{"q\a" => ''}], {OUT => "q\a\n"}],
+ ['q-q', '-q', [{"q\a" => ''}], {OUT => "q?\n"}],
+ ['q-Q', '-Q', [{"q\a" => ''}], {OUT => "\"q\\a\"\n"}],
+
+ ['q-qs-lit', '--quoting=literal', [{"q\a" => ''}], {OUT => "q\a\n"}],
+ ['q-qs-sh', '--quoting=shell', [{"q\a" => ''}], {OUT => "q\a\n"}],
+ ['q-qs-sh-a', '--quoting=shell-always', [{"q\a"=>''}], {OUT => "'q\a'\n"}],
+ ['q-qs-c', '--quoting=c', [{"q\a" => ''}], {OUT => "\"q\\a\"\n"}],
+ ['q-qs-esc', '--quoting=escape', [{"q\a" => ''}], {OUT => "q\\a\n"}],
+ );
+
+my $save_temps = 0;
+my $verbose = 0;
+
+my $prog = $ENV{LS} || 'ls';
+my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
+exit $fail;