This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Create subdirectory t/opbasic. Move 5 test files there.
[perl5.git] / t / run / mad.t
1 #!./perl
2 #
3 # Tests for Perl mad environment
4 #
5 # $PERL_XMLDUMP
6
7 BEGIN {
8     chdir 't' if -d 't';
9     @INC = '../lib';
10     require Config; import Config;
11     require './test.pl';
12     skip_all_without_config('mad');
13 }
14
15 use File::Path;
16 use File::Spec;
17
18 my $tempdir = tempfile;
19
20 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
21 unshift @INC, '../../lib';
22 my $cleanup = 1;
23
24 END {
25     if ($cleanup) {
26         rmtree($tempdir);
27     }
28 }
29
30 plan tests => 4;
31
32 {
33     delete local $ENV{$_} for keys %ENV;
34     my $fn = File::Spec->catfile(File::Spec->curdir(), "withoutT.xml");
35     $ENV{PERL_XMLDUMP} = $fn;
36     fresh_perl_is('print q/hello/', '', {}, 'mad without -T');
37     ok(-f $fn, "xml file created without -T as expected");
38 }
39
40 {
41     delete local $ENV{$_} for keys %ENV;
42     my $fn = File::Spec->catfile(File::Spec->curdir(), "withT.xml");
43     fresh_perl_is('print q/hello/', 'hello', { switches => [ "-T" ] },
44                   'mad with -T');
45     ok(!-e $fn, "no xml file created with -T as expected");
46 }