6 # Before `make install' is performed this script should be runnable with
7 # `make test'. After `make install' it should work as `perl test.pl'
9 ######################### We start with some black magic to print on failure.
11 # Change 1..1 below to 1..last_test_to_print .
12 # (It may become useful if the test is moved to ./t subdirectory.)
14 BEGIN { $| = 1; print "1..81\n"; }
15 END {print "not ok 1\n" unless $loaded;}
16 use Text::Balanced qw ( extract_variable );
20 use vars qw( $DEBUG );
21 sub debug { print "\t>>>",@_ if $DEBUG }
23 ######################### End of black magic.
28 while (defined($str = <DATA>))
31 if ($str =~ s/\A# USING://) { $neg = 0; $cmd = $str; next; }
32 elsif ($str =~ /\A# TH[EI]SE? SHOULD FAIL/) { $neg = 1; next; }
33 elsif (!$str || $str =~ /\A#/) { $neg = 0; next }
35 debug "\tUsing: $cmd\n";
36 debug "\t on: [$str]\n";
39 $var = eval "\@res = $cmd";
40 debug "\t list got: [" . join("|",@res) . "]\n";
41 debug "\t list left: [$str]\n";
42 print "not " if (substr($str,pos($str)||0,1) eq ';')==$neg;
43 print "ok ", $count++;
44 print " ($@)" if $@ && $DEBUG;
49 $var = "<undef>" unless defined $var;
50 debug "\t scalar got: [$var]\n";
51 debug "\t scalar left: [$str]\n";
52 print "not " if ($str =~ '\A;')==$neg;
53 print "ok ", $count++;
54 print " ($@)" if $@ && $DEBUG;
60 # USING: extract_variable($str);
63 $a (1..3) { print $a };
65 # USING: extract_variable($str);
88 @{$obj->nextval($cat,$dog)->{new}};
89 @{$obj->nextval($cat?$dog:$fish)->{new}};
90 @{$obj->nextval(cat()?$dog:$fish)->{new}};
92 $a::b::c{d}->{$e->()};
93 $a'b'c'd{e}->{$e->()};
94 $a'b::c'd{e}->{$e->()};
106 # USING: extract_variable($str,'=*');