8 # Before `make install' is performed this script should be runnable with
9 # `make test'. After `make install' it should work as `perl test.pl'
11 ######################### We start with some black magic to print on failure.
13 # Change 1..1 below to 1..last_test_to_print .
14 # (It may become useful if the test is moved to ./t subdirectory.)
16 BEGIN { $| = 1; print "1..183\n"; }
17 END {print "not ok 1\n" unless $loaded;}
18 use Text::Balanced qw ( extract_variable );
22 use vars qw( $DEBUG );
23 sub debug { print "\t>>>",@_ if $DEBUG }
25 ######################### End of black magic.
30 while (defined($str = <DATA>))
33 if ($str =~ s/\A# USING://) { $neg = 0; $cmd = $str; next; }
34 elsif ($str =~ /\A# TH[EI]SE? SHOULD FAIL/) { $neg = 1; next; }
35 elsif (!$str || $str =~ /\A#/) { $neg = 0; next }
37 debug "\tUsing: $cmd\n";
38 debug "\t on: [$str]\n";
41 $var = eval "\@res = $cmd";
42 debug "\t list got: [" . join("|",@res) . "]\n";
43 debug "\t list left: [$str]\n";
44 print "not " if (substr($str,pos($str)||0,1) eq ';')==$neg;
45 print "ok ", $count++;
46 print " ($@)" if $@ && $DEBUG;
51 $var = "<undef>" unless defined $var;
52 debug "\t scalar got: [$var]\n";
53 debug "\t scalar left: [$str]\n";
54 print "not " if ($str =~ '\A;')==$neg;
55 print "ok ", $count++;
56 print " ($@)" if $@ && $DEBUG;
62 # USING: extract_variable($str);
65 $a (1..3) { print $a };
67 # USING: extract_variable($str);
92 @{$obj->nextval($cat,$dog)->{new}};
93 @{$obj->nextval($cat?$dog:$fish)->{new}};
94 @{$obj->nextval(cat()?$dog:$fish)->{new}};
96 $a::b::c{d}->{$e->()};
97 $a'b'c'd{e}->{$e->()};
98 $a'b::c'd{e}->{$e->()};
150 ${^WIDE_SYSTEM_CALLS};
159 # USING: extract_variable($str,'=*');