Last active
December 18, 2015 08:39
-
-
Save yappo/5755267 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test::More; | |
use Capture::Tiny ':all'; | |
use Devel::Peek; | |
package Yappo { | |
sub proto () { 1 } | |
}; | |
subtest 'prototype' => sub { | |
my(undef, $stdout, undef) = capture { | |
Dump(Yappo::proto); | |
}; | |
unlike $stdout, qr/PV = /; # failed ! | |
my $x = Yappo::proto . ''; # create PV value for Yappo :: proto | |
(undef, $stdout, undef) = capture { | |
Dump(Yappo::proto); | |
}; | |
unlike $stdout, qr/PV = /; # failed ! | |
}; | |
done_testing; | |
__END__ | |
$ perl -MO=Deparse | |
sub Yappo::proto () { 1 } | |
use Test::More; | |
use Capture::Tiny (':all'); | |
use Devel::Peek; | |
package main; | |
use warnings; | |
use strict; | |
{;}; | |
subtest('prototype', sub { | |
my(undef, $stdout, undef) = capture(sub { | |
Dump(1); | |
} | |
); | |
unlike $stdout, qr/PV = /; | |
my $x = '1'; | |
(undef, $stdout, undef) = capture(sub { | |
Dump(1); | |
} | |
); | |
unlike $stdout, qr/PV = /; | |
} | |
); | |
done_testing(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment