add warnings tests, for authors only
[p5sagit/Sub-Name.git] / t / RT96893_perlcc.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
6
7 plan skip_all => 'B::C required for testing perlcc -O3'
8     unless eval { +require B::C; };
9
10 plan skip_all => 'B::C is too old (require 1.48, have ' . ($B::C::VERSION || 'undef') . ')'
11     unless eval { B::C->VERSION('1.48') };
12
13 plan skip_all => 'Devel::CheckBin required for looking for a perlcc executable'
14     unless eval { +require Devel::CheckBin };
15
16 plan skip_all => 'perlcc required' unless Devel::CheckBin::can_run('perlcc');
17
18 my $f = "t/rt96893x.pl";
19 open my $fh, ">", $f; END { unlink $f if $f }
20 print $fh 'use Sub::Name; subname("main::bar", sub{42}); print "# successfully ran subname() with perlcc\n";';
21 close $fh;
22
23 system($^X, qw(-Mblib -S perlcc -O3 -UCarp -UConfig -r), $f);
24
25 local $TODO = 'experimental, for informational purposes only';
26 is($? >> 8, 0, 'executable completed successfully');
27
28 unlink "t/rt96893x", "t/rt96893x.exe";
29
30 done_testing;
31 # vim: ft=perl