File: 10_prereq_computed.t

package info (click to toggle)
libcpan-reporter-perl 1.2020-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,752 kB
  • sloc: perl: 5,440; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (3)
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
#!perl
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }

use FindBin;
use File::Temp 'tempfile';
use Test::More tests => 1;

use CPAN::Reporter::PrereqCheck ();

{
    my($tmpfh,$tmpfile) = tempfile(UNLINK => 1);
    print $tmpfh <<EOF;
Bogus::ComputedVersion 0 1.00
EOF
    close $tmpfh or die $!;

    local @ARGV = $tmpfile;
    local @INC = (@INC, "$FindBin::RealBin/perl5lib");

    ## open stdout to a variable
    open OLDOUT, ">&", \*STDOUT;
    close STDOUT;
    my $output = '';
    open STDOUT, ">", \$output;

    CPAN::Reporter::PrereqCheck::_run();

    ## put things back
    open STDOUT, ">&", \*OLDOUT;

    is $output, "Bogus::ComputedVersion 1 1.00\n";
}