#!/usr/bin/perl -w 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 $q_bell = {IN => {"q\a" => ''}}; my @Tests = ( # test-name options input expected-output # ['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"}], ); my $save_temps = 0; 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;