1b39c5158Smillert#!/usr/bin/perl -w
2b39c5158Smillert
3*256a93a4Safresh1use strict;
4*256a93a4Safresh1use warnings;
5*256a93a4Safresh1
6b39c5158Smillert# This is a test of WriteEmptyMakefile.
7b39c5158Smillert
8b39c5158SmillertBEGIN {
9b39c5158Smillert    unshift @INC, 't/lib';
10b39c5158Smillert}
11b39c5158Smillert
126fb12b70Safresh1use File::Temp qw[tempdir];
136fb12b70Safresh1my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
145759b3d2Safresh1use Cwd; my $cwd = getcwd; END { chdir $cwd } # so File::Temp can cleanup
156fb12b70Safresh1chdir $tmpdir;
16b39c5158Smillert
17b39c5158Smillertuse strict;
18b39c5158Smillertuse Test::More tests => 5;
19b39c5158Smillert
20b39c5158Smillertuse ExtUtils::MakeMaker qw(WriteEmptyMakefile);
21b39c5158Smillertuse TieOut;
22b39c5158Smillert
23b39c5158Smillertcan_ok __PACKAGE__, 'WriteEmptyMakefile';
24b39c5158Smillert
25b39c5158Smillerteval { WriteEmptyMakefile("something"); };
26b39c5158Smillertlike $@, qr/Need an even number of args/;
27b39c5158Smillert
28b39c5158Smillert
29b39c5158Smillert{
30b39c5158Smillert    ok( my $stdout = tie *STDOUT, 'TieOut' );
31b39c5158Smillert
32b39c5158Smillert    ok !-e 'wibble';
33b39c5158Smillert    END { 1 while unlink 'wibble' }
34b39c5158Smillert
35b39c5158Smillert    WriteEmptyMakefile(
36b39c5158Smillert        NAME            => "Foo",
37b39c5158Smillert        FIRST_MAKEFILE  => "wibble",
38b39c5158Smillert    );
39b39c5158Smillert    ok -e 'wibble';
40b39c5158Smillert}
41