This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
no [] in tr///
[perl5.git] / t / comp / our.t
CommitLineData
cb1ce608
YST
1#!./perl
2
3BEGIN {
4 chdir 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9print "1..6\n";
10
11{
12 package TieAll;
13 # tie, track, and report what calls are made
14 my @calls;
15 sub AUTOLOAD {
16 for ($AUTOLOAD =~ /TieAll::(.*)/) {
17 if (/TIE/) { return bless {} }
18 elsif (/calls/) { return join ',', splice @calls }
19 else {
20 push @calls, $_;
21 # FETCHSIZE doesn't like undef
22 # if FIRSTKEY, see if NEXTKEY is also called
23 return 1 if /FETCHSIZE|FIRSTKEY/;
24 return;
25 }
26 }
27 }
28}
29
30tie $x, 'TieAll';
31tie @x, 'TieAll';
32tie %x, 'TieAll';
33
34{our $x;}
35is(TieAll->calls, '', 'our $x has no runtime effect');
36{our ($x);}
37is(TieAll->calls, '', 'our ($x) has no runtime effect');
38{our %x;}
39is(TieAll->calls, '', 'our %x has no runtime effect');
40
41{
42 local $TODO = 'perl #17376';
43 {our (%x);}
44 is(TieAll->calls, '', 'our (%x) has no runtime effect');
45 {our @x;}
46 is(TieAll->calls, '', 'our @x has no runtime effect');
47 {our (@x);}
48 is(TieAll->calls, '', 'our (@x) has no runtime effect');
49}