xref: /openbsd-src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/WriteEmptyMakefile.t (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1#!/usr/bin/perl -w
2
3# This is a test of WriteEmptyMakefile.
4
5BEGIN {
6    unshift @INC, 't/lib';
7}
8
9use File::Temp qw[tempdir];
10my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
11chdir $tmpdir;
12
13use strict;
14use Test::More tests => 5;
15
16use ExtUtils::MakeMaker qw(WriteEmptyMakefile);
17use TieOut;
18
19can_ok __PACKAGE__, 'WriteEmptyMakefile';
20
21eval { WriteEmptyMakefile("something"); };
22like $@, qr/Need an even number of args/;
23
24
25{
26    ok( my $stdout = tie *STDOUT, 'TieOut' );
27
28    ok !-e 'wibble';
29    END { 1 while unlink 'wibble' }
30
31    WriteEmptyMakefile(
32        NAME            => "Foo",
33        FIRST_MAKEFILE  => "wibble",
34    );
35    ok -e 'wibble';
36}
37