Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b16d217bcd
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (36 sloc) 1.153 kb
#! /usr/bin/env perl
# http://code.google.com/p/perl-compiler/issues/detail?id=96
# defined &gv should not store the gv->CV
use strict;
BEGIN {
unshift @INC, 't';
require "test.pl";
}
use Test::More;
plan tests => 3;
my $script = 'defined(&B::OP::name) && print q(ok)';
sub compile_check {
my ($num,$b,$base,$script,$cmt) = @_;
my $name = $base."_$num";
unlink("$name.c", "$name.pl");
open F, ">", "$name.pl";
print F $script;
close F;
my $X = $^X =~ m/\s/ ? qq{"$^X"} : $^X;
my ($result,$out,$stderr) =
run_cmd("$X -Iblib/arch -Iblib/lib -MO=$b,-o$name.c $name.pl", 20);
unless (-e "$name.c") {
print "not ok $num # $name B::$b failed\n";
exit;
}
# check stderr for "blocking not found"
#diag length $stderr," ",length $out;
if (!$stderr and $out) {
$stderr = $out;
}
$stderr =~ s/main::stderr.*//s;
like($stderr,qr/skip saving defined\(&B::OP::name\)/, "detect defined(&B::OP::name)");
like($stderr,qr/GV::save \*B::OP::name done/, "should save *B::OP::name");
unlike($stderr,qr/GV::save &B::OP::name/, "should not save &B::OP::name");
}
compile_check(1,'C,-O3,-DGC','ccode96i',$script,"");
Jump to Line
Something went wrong with that request. Please try again.