1N/A if ($ENV{PERL_CORE}) {
1N/A chdir('t') if -d 't';
1N/A# Before `make install' is performed this script should be runnable with
1N/A# `make test'. After `make install' it should work as `perl
test.pl'
1N/A######################### We start with some black magic to print on failure.
1N/A# (It may become useful if the test is moved to ./t subdirectory.)
1N/ABEGIN { $| = 1; print "1..45\n"; }
1N/AEND {print "not ok 1\n" unless $loaded;}
1N/Ause Text::Balanced qw ( extract_delimited );
1N/Ause vars qw( $DEBUG );
1N/Asub debug { print "\t>>>",@_ if $DEBUG }
1N/A######################### End of black magic.
1N/Awhile (defined($str = <DATA>))
1N/A if ($str =~ s/\A# USING://) { $neg = 0; $cmd = $str; next; }
1N/A elsif ($str =~ /\A# TH[EI]SE? SHOULD FAIL/) { $neg = 1; next; }
1N/A elsif (!$str || $str =~ /\A#/) { $neg = 0; next }
1N/A debug "\tUsing: $cmd\n";
1N/A debug "\t on: [$str]\n";
1N/A $var = eval "() = $cmd";
1N/A debug "\t list got: [$var]\n";
1N/A debug "\t list left: [$str]\n";
1N/A print "not " if (substr($str,pos($str)||0,1) eq ';')==$neg;
1N/A print "ok ", $count++;
1N/A print " ($@)" if $@ && $DEBUG;
1N/A $var = "<undef>" unless defined $var;
1N/A debug "\t scalar got: [$var]\n";
1N/A debug "\t scalar left: [$str]\n";
1N/A print "not " if ($str =~ '\A;')==$neg;
1N/A print "ok ", $count++;
1N/A print " ($@)" if $@ && $DEBUG;
1N/A# USING: extract_delimited($str,'/#$',undef,'/#$');
1N/A# TEST EXTRACTION OF DELIMITED TEXT WITH ESCAPES
1N/A# USING: extract_delimited($str,'/#$',undef,'\\');
1N/A# TEST EXTRACTION OF DELIMITED TEXT
1N/A# USING: extract_delimited($str);
1N/A# TEST EXTRACTION OF DELIMITED TEXT
1N/A# USING: extract_delimited($str,'/#$','-->');