This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make do "a\0b" fail silently instead of throwing (RT #129928)
[perl5.git] / t / op / defined.t
1 #!perl
2 BEGIN {
3     chdir 't' if -d 't';
4     require './test.pl';
5 }
6
7 plan 5;
8
9 sub notdef { undef }
10
11 # [perl #97466]
12 # These should actually call the sub, instead of testing the sub itself
13 ok !defined do { &notdef }, 'defined do { &sub }';
14 ok !defined(scalar(42,&notdef)), 'defined(scalar(42,&sub))';
15 ok !defined do{();&notdef}, '!defined do{();&sub}';
16
17 # Likewise, these should evaluate @array in scalar context
18 no warnings "deprecated";
19 ok defined($false ? $scalar : @array), 'defined( ... ? ... : @array)';
20 ok defined(scalar @array), 'defined(scalar @array)';