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