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 );
11use Cwd; my $cwd = getcwd; END { chdir $cwd } # so File::Temp can cleanup
12chdir $tmpdir;
13
14use strict;
15use Test::More tests => 5;
16
17use ExtUtils::MakeMaker qw(WriteEmptyMakefile);
18use TieOut;
19
20can_ok __PACKAGE__, 'WriteEmptyMakefile';
21
22eval { WriteEmptyMakefile("something"); };
23like $@, qr/Need an even number of args/;
24
25
26{
27    ok( my $stdout = tie *STDOUT, 'TieOut' );
28
29    ok !-e 'wibble';
30    END { 1 while unlink 'wibble' }
31
32    WriteEmptyMakefile(
33        NAME            => "Foo",
34        FIRST_MAKEFILE  => "wibble",
35    );
36    ok -e 'wibble';
37}
38