This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/loc_tools.pl: Consider thread 0 always locale-safe
[perl5.git] / t / run / switchDx.t
CommitLineData
2cd79449
TC
1#!./perl -w
2BEGIN {
3 chdir 't' if -d 't';
4 @INC = '../lib';
5 require './test.pl';
6 skip_all_if_miniperl();
7}
8
9use Config;
10
11my $perlio_log = "perlio$$.txt";
12
13skip_all "DEBUGGING build required"
81962cbb 14 unless $::Config{ccflags} =~ /(?<!\S)-DDEBUGGING(?!\S)/
2cd79449
TC
15 or $^O eq 'VMS' && $::Config{usedebugging_perl} eq 'Y';
16
64320867 17plan tests => 8;
2cd79449
TC
18
19END {
20 unlink $perlio_log;
21}
22{
23 unlink $perlio_log;
24 local $ENV{PERLIO_DEBUG} = $perlio_log;
25 fresh_perl_is("print qq(hello\n)", "hello\n",
26 { stderr => 1 },
27 "No perlio debug file without -Di...");
28 ok(!-e $perlio_log, "...no perlio.txt found");
5b3e7d5f 29 fresh_perl_like("print qq(hello\n)", qr/\nEXECUTING...\n{1,2}hello\n?/,
2cd79449
TC
30 { stderr => 1, switches => [ "-Di" ] },
31 "Perlio debug file with both -Di and PERLIO_DEBUG...");
32 ok(-e $perlio_log, "... perlio debugging file found with -Di and PERLIO_DEBUG");
33
34 unlink $perlio_log;
64320867 35 fresh_perl_like("print qq(hello\n)", qr/define raw/,
2cd79449 36 { stderr => 1, switches => [ "-TDi" ] },
64320867 37 "Perlio debug output to stderr with -TDi (with PERLIO_DEBUG)...");
2cd79449
TC
38 ok(!-e $perlio_log, "...no perlio debugging file found");
39}
64320867
TC
40
41{
42 local $ENV{PERLIO_DEBUG};
43 fresh_perl_like("print qq(hello)", qr/define raw/,
44 { stderr => 1, switches => [ '-Di' ] },
45 "-Di defaults to stderr");
46 fresh_perl_like("print qq(hello)", qr/define raw/,
47 { stderr => 1, switches => [ '-TDi' ] },
48 "Perlio debug output to STDERR with -TDi (no PERLIO_DEBUG)");
49}
50