1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
4 ######################### We start with some black magic to print on failure.
6 # Change 1..1 below to 1..last_test_to_print .
7 # (It may become useful if the test is moved to ./t subdirectory.)
9 BEGIN { $| = 1; print "1..183\n"; }
10 END {print "not ok 1\n" unless $loaded;}
11 use Text::Balanced qw ( extract_variable );
15 use vars qw( $DEBUG );
16 sub debug { print "\t>>>",@_ if $DEBUG }
18 ######################### End of black magic.
23 while (defined($str = <DATA>))
26 if ($str =~ s/\A# USING://) { $neg = 0; $cmd = $str; next; }
27 elsif ($str =~ /\A# TH[EI]SE? SHOULD FAIL/) { $neg = 1; next; }
28 elsif (!$str || $str =~ /\A#/) { $neg = 0; next }
30 debug "\tUsing: $cmd\n";
31 debug "\t on: [$str]\n";
34 $var = eval "\@res = $cmd";
35 debug "\t list got: [" . join("|",map {defined $_ ? $_ : '<undef>'} @res) . "]\n";
36 debug "\t list left: [$str]\n";
37 print "not " if (substr($str,pos($str)||0,1) eq ';')==$neg;
38 print "ok ", $count++;
39 print " ($@)" if $@ && $DEBUG;
44 $var = "<undef>" unless defined $var;
45 debug "\t scalar got: [$var]\n";
46 debug "\t scalar left: [$str]\n";
47 print "not " if ($str =~ '\A;')==$neg;
48 print "ok ", $count++;
49 print " ($@)" if $@ && $DEBUG;
55 # USING: extract_variable($str);
58 $a (1..3) { print $a };
60 # USING: extract_variable($str);
85 @{$obj->nextval($cat,$dog)->{new}};
86 @{$obj->nextval($cat?$dog:$fish)->{new}};
87 @{$obj->nextval(cat()?$dog:$fish)->{new}};
89 $a::b::c{d}->{$e->()};
90 $a'b'c'd{e}->{$e->()};
91 $a'b::c'd{e}->{$e->()};
143 ${^WIDE_SYSTEM_CALLS};
152 # USING: extract_variable($str,'=*');