File: basic.t

package info (click to toggle)
perlindex 1.606-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 308 kB
  • sloc: perl: 558; sh: 54; makefile: 7
file content (54 lines) | stat: -rw-r--r-- 1,262 bytes parent folder | download | duplicates (6)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl -w
#                              -*- Mode: Perl -*- 
# $Basename$
# $Revision: 1.3 $
# Author          : Ulrich Pfeifer
# Created On      : Wed Jun 18 19:44:37 2003
# Last Modified By: Ulrich Pfeifer
# Last Modified On: Tue Oct 21 10:29:42 2008
# Language        : CPerl
# 
# (C) Copyright 2003, UUNET Deutschland GmbH, Germany
# 
use strict;
use Test;
BEGIN {
    if (!eval {
	require File::Temp;
	require File::Spec;
	require Cwd;
	1;
    }) {
	print "1..0 # SKIP: File::Temp and/or File::Spec not available, skipping tests\n";
	exit(0);
    }
    File::Temp->import(qw(tempdir));
}
BEGIN { plan tests => 2, todo => [] }

sub run {
  my ($cmd, $test) = @_;

  local $/;
  open(SUB, "$^X $cmd < " . File::Spec->devnull . " 2>&1 |") or die $!;
  my $result = <SUB>;
  close SUB or return;

  return &$test($result);
}

my $tmp = tempdir(CLEANUP => 1);
my $cwd = Cwd::getcwd();

ok(
   run(
       "-Mblib ./perlindex -conf debian/config/config -idir $tmp --index $cwd/README $cwd/MANIFEST $cwd/perlindex.PL",
       sub { print "[[$_[0]]]\n"; $_[0] =~ /MANIFEST/ }
      )
  );
ok(
   run(
       "-Mblib ./perlindex -conf debian/config/config -idir $tmp --nomenu index",
       sub { print "[[$_[0]]]\n"; $_[0] =~ /perlindex.PL/ }
      )
  );