4
# Copyright (C) 2006-2011 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/>.
22
(my $program_name = $0) =~ s|.*/||;
24
# Turn off localization of executable's output.
25
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
27
my $stat_single = stat('/');
28
my $stat_double = stat('//');
29
my $double_slash = ($stat_single->dev == $stat_double->dev
30
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
36
['fail-1', {ERR => "$prog: missing operand\n"
37
. "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
38
['fail-2', qw(a b), {ERR => "$prog: extra operand `b'\n"
39
. "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
41
['a', qw(d/f), {OUT => 'd'}],
42
['b', qw(/d/f), {OUT => '/d'}],
43
['c', qw(d/f/), {OUT => 'd'}],
44
['d', qw(d/f//), {OUT => 'd'}],
45
['e', qw(f), {OUT => '.'}],
46
['f', qw(/), {OUT => '/'}],
47
['g', qw(//), {OUT => "$double_slash"}],
48
['h', qw(///), {OUT => '/'}],
49
['i', qw(//a//), {OUT => "$double_slash"}],
50
['j', qw(///a///), {OUT => '/'}],
51
['k', qw(///a///b), {OUT => '///a'}],
52
['l', qw(///a//b/), {OUT => '///a'}],
53
['m', qw(''), {OUT => '.'}],
56
# Append a newline to end of each expected `OUT' string.
64
$e->{OUT} = "$e->{OUT}\n"
65
if ref $e eq 'HASH' and exists $e->{OUT};
69
my $save_temps = $ENV{SAVE_TEMPS};
70
my $verbose = $ENV{VERBOSE};
72
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);