This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get t/uni/cache.t working under minitest
[perl5.git] / t / op / my_stash.t
CommitLineData
def3634b
GS
1#!./perl
2
3package Foo;
4
036b4402 5BEGIN {
88587957 6 chdir 't' if -d 't';
20822f61 7 @INC = '../lib';
97589313 8 require './test.pl';
036b4402
GS
9}
10
c41f466f 11plan 9;
def3634b
GS
12
13use constant MyClass => 'Foo::Bar::Biz::Baz';
14
15{
16 package Foo::Bar::Biz::Baz;
0a0ab32c 17 1;
def3634b
GS
18}
19
20for (qw(Foo Foo:: MyClass __PACKAGE__)) {
21 eval "sub { my $_ \$obj = shift; }";
22 ok ! $@;
23# print $@ if $@;
24}
25
26use constant NoClass => 'Nope::Foo::Bar::Biz::Baz';
27
28for (qw(Nope Nope:: NoClass)) {
29 eval "sub { my $_ \$obj = shift; }";
30 ok $@;
31# print $@ if $@;
32}
c41f466f
FC
33
34is runperl(prog => 'my main $r; sub FIELDS; $$r{foo}; print qq-ok\n-'),
35 "ok\n",
36 'no crash with hash element when FIELDS sub stub exists';
37is runperl(prog => 'my main $r; sub FIELDS; @$r{f,b}; print qq-ok\n-'),
38 "ok\n",
39 'no crash with hash slice when FIELDS sub stub exists';