summaryrefslogtreecommitdiff
path: root/tests/tac/Test.pm
blob: cf90d7bab1b6c7ca8865aa49800228d3302da78b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Test;
require 5.002;
use strict;

my @tv = (
# test name, options, input, expected output, expected return code
#
['basic-0', '', "", "", 0],
['basic-a', '', "a", "a\n", 0],
['basic-b', '', "\n", "\n", 0],
['basic-c', '', "a\n", "a\n", 0],
['basic-d', '', "a\nb", "b\na\n", 0],
['basic-e', '', "a\nb\n", "b\na\n", 0],
);

sub test_vector
{
  my $t;
  foreach $t (@tv)
    {
      my ($test_name, $flags, $in, $exp, $ret) = @$t;

      # If you run the minus* tests with a FILE arg they'd hang.
      if ($test_name =~ /^minus/)
	{
	  $Test::input_via{$test_name} = {REDIR => 0, PIPE => 0};
	}
      else
	{
	  $Test::input_via{$test_name} = {REDIR => 0, FILE => 0, PIPE => 0}
	}
    }

  return @tv;
}

1;