~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/misc/basename.pl

  • Committer: Colin Watson
  • Date: 2013-10-30 15:48:33 UTC
  • mfrom: (8.3.5 sid)
  • Revision ID: cjwatson@canonical.com-20131030154833-xdt6e1yfffqom1c4
merge from Debian 8.21-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl
2
2
# Test basename.
3
 
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
3
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
4
4
 
5
5
# This program is free software: you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
61
61
     ['8', qw(fs x),       {OUT => 'fs'}],
62
62
     ['9', qw(fs ''),      {OUT => 'fs'}],
63
63
     ['10', qw(fs/ s/),    {OUT => 'fs'}],
 
64
 
 
65
     # Exercise -z option.
 
66
     ['z0', qw(-z a),       {OUT => "a\0"}],
 
67
     ['z1', qw(--zero a),   {OUT => "a\0"}],
 
68
     ['z2', qw(-za a b),    {OUT => "a\0b\0"}],
 
69
     ['z3', qw(-z ba a),    {OUT => "b\0"}],
 
70
     ['z4', qw(-z -s a ba), {OUT => "b\0"}],
64
71
   );
65
72
 
66
73
# Append a newline to end of each expected 'OUT' string.
 
74
# Skip -z tests, i.e. those whose 'OUT' string has a trailing '\0'.
67
75
my $t;
68
76
foreach $t (@Tests)
69
77
  {
72
80
    foreach $e (@$t)
73
81
      {
74
82
        $e->{OUT} = "$e->{OUT}\n"
75
 
          if ref $e eq 'HASH' and exists $e->{OUT};
 
83
          if ref $e eq 'HASH' and exists $e->{OUT}
 
84
            and not $e->{OUT} =~ /\0$/;
76
85
      }
77
86
  }
78
87