diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-03-24 22:43:43 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-03-24 22:43:43 +0000 |
commit | 1ffc832540d59b3c65984a104a6d8e8a94040b31 (patch) | |
tree | 7029dd686746010b400a7c4decfd585de850e3db /t | |
parent | f10488a30a54084364344ffc896da5ef9ee55e71 (diff) | |
parent | 562a7b0c67b6218259506760bd4728f2f0c6093b (diff) | |
download | perl-1ffc832540d59b3c65984a104a6d8e8a94040b31.tar.gz |
Integrate from mainperl.
p4raw-id: //depot/cfgperl@3156
Diffstat (limited to 't')
-rwxr-xr-x | t/comp/require.t | 2 | ||||
-rwxr-xr-x | t/lib/filefunc.t | 17 | ||||
-rwxr-xr-x | t/lib/io_udp.t | 2 | ||||
-rwxr-xr-x | t/lib/posix.t | 2 | ||||
-rwxr-xr-x | t/lib/thread.t | 16 | ||||
-rwxr-xr-x | t/op/lex_assign.t | 7 | ||||
-rwxr-xr-x | t/op/taint.t | 2 | ||||
-rwxr-xr-x | t/pod/emptycmd.t | 21 | ||||
-rw-r--r-- | t/pod/emptycmd.xr | 2 | ||||
-rwxr-xr-x | t/pod/for.t | 59 | ||||
-rw-r--r-- | t/pod/for.xr | 19 | ||||
-rwxr-xr-x | t/pod/headings.t | 140 | ||||
-rw-r--r-- | t/pod/headings.xr | 29 | ||||
-rwxr-xr-x | t/pod/include.t | 36 | ||||
-rw-r--r-- | t/pod/include.xr | 23 | ||||
-rwxr-xr-x | t/pod/included.t | 35 | ||||
-rw-r--r-- | t/pod/included.xr | 3 | ||||
-rwxr-xr-x | t/pod/lref.t | 66 | ||||
-rw-r--r-- | t/pod/lref.xr | 40 | ||||
-rwxr-xr-x | t/pod/nested_items.t | 64 | ||||
-rw-r--r-- | t/pod/nested_items.xr | 19 | ||||
-rwxr-xr-x | t/pod/nested_seqs.t | 23 | ||||
-rw-r--r-- | t/pod/nested_seqs.xr | 3 | ||||
-rwxr-xr-x | t/pod/oneline_cmds.t | 46 | ||||
-rw-r--r-- | t/pod/oneline_cmds.xr | 29 | ||||
-rwxr-xr-x | t/pod/poderrs.t | 39 | ||||
-rw-r--r-- | t/pod/poderrs.xr | 11 | ||||
-rwxr-xr-x | t/pod/special_seqs.t | 30 | ||||
-rw-r--r-- | t/pod/special_seqs.xr | 13 | ||||
-rw-r--r-- | t/pod/testcmp.pl | 90 | ||||
-rw-r--r-- | t/pod/testp2pt.pl | 177 | ||||
-rw-r--r-- | t/pod/testpchk.pl | 129 | ||||
-rwxr-xr-x | t/pragma/utf8.t | 37 | ||||
-rw-r--r-- | t/pragma/warn/util | 6 |
34 files changed, 1226 insertions, 11 deletions
diff --git a/t/comp/require.t b/t/comp/require.t index fc72c079b0..581dcba75c 100755 --- a/t/comp/require.t +++ b/t/comp/require.t @@ -45,7 +45,7 @@ do_require "1"; print "# $@\nnot " if $@; print "ok ",$i++,"\n"; -END { unlink 'bleah.pm'; } +END { 1 while unlink 'bleah.pm'; } # ***interaction with pod (don't put any thing after here)*** diff --git a/t/lib/filefunc.t b/t/lib/filefunc.t new file mode 100755 index 0000000000..46a1e35774 --- /dev/null +++ b/t/lib/filefunc.t @@ -0,0 +1,17 @@ +#!./perl + +BEGIN { + $^O = ''; + chdir 't' if -d 't'; + unshift @INC, '../lib'; +} + +print "1..1\n"; + +use File::Spec::Functions; + +if (catfile('a','b','c') eq 'a/b/c') { + print "ok 1\n"; +} else { + print "not ok 1\n"; +} diff --git a/t/lib/io_udp.t b/t/lib/io_udp.t index 1434873125..435533f6c4 100755 --- a/t/lib/io_udp.t +++ b/t/lib/io_udp.t @@ -13,7 +13,7 @@ BEGIN { if(-d "lib" && -f "TEST") { if ( ($Config{'extensions'} !~ /\bSocket\b/ || $Config{'extensions'} !~ /\bIO\b/ || - $^O eq 'os2') && + ($^O eq 'os2') || $^O eq 'apollo') && !(($^O eq 'VMS') && $Config{d_socket})) { print "1..0\n"; exit 0; diff --git a/t/lib/posix.t b/t/lib/posix.t index 6f72a8ee6b..4c6aa49a05 100755 --- a/t/lib/posix.t +++ b/t/lib/posix.t @@ -97,5 +97,5 @@ print POSIX::strftime("ok 18 # %H:%M, on %D\n", localtime()); $| = 0; # The following line assumes buffered output, which may be not true with EMX: -print '@#!*$@(!@#$' unless ($^O eq 'os2' || $^O eq 'uwin'); +print '@#!*$@(!@#$' unless ($^O eq 'os2' || $^O eq 'uwin' || $^O eq 'os390'); _exit(0); diff --git a/t/lib/thread.t b/t/lib/thread.t index 8d385236cc..61997cfc8b 100755 --- a/t/lib/thread.t +++ b/t/lib/thread.t @@ -13,7 +13,7 @@ BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; } $| = 1; -print "1..14\n"; +print "1..18\n"; use Thread; print "ok 1\n"; @@ -71,3 +71,17 @@ sub islocked $t = Thread->new(\&islocked, "ok 13\n", "ok 14\n"); $t->join->join; +{ + package Loch::Ness; + sub new { bless [], shift } + sub monster { + use attrs qw(locked method); + my($s, $m) = @_; + print "ok $m\n"; + } + sub gollum { &monster } +} +Loch::Ness->monster(15); +Loch::Ness->new->monster(16); +Loch::Ness->gollum(17); +Loch::Ness->new->gollum(18); diff --git a/t/op/lex_assign.t b/t/op/lex_assign.t index cf16a46904..b2acd65d75 100755 --- a/t/op/lex_assign.t +++ b/t/op/lex_assign.t @@ -7,11 +7,12 @@ BEGIN { umask 0; $xref = \ ""; +$runme = ($^O eq 'VMS' ? 'MCR ' : '') . $^X; @a = (1..5); %h = (1..6); $aref = \@a; $href = \%h; -open OP, qq{$^X -le "print 'aaa Ok ok' for 1..100"|}; +open OP, qq{$runme -le "print 'aaa Ok ok' for 1..100"|}; $chopit = 'aaaaaa'; @chopar = (113 .. 119); $posstr = '123456'; @@ -62,7 +63,7 @@ EOE __END__ ref $xref # ref ref $cstr # ref nonref -`ls` # backtick skip(MSWin32) +`$runme -e "print qq[1\n]"` # backtick skip(MSWin32) `$undefed` # backtick undef skip(MSWin32) <*> # glob <OP> # readline @@ -187,7 +188,7 @@ readlink 'non-existent', 'non-existent1' # readlink '???' # fork '???' # wait '???' # waitpid -system "$^X -e 0" # system +system "$runme -e 0" # system skip(VMS) '???' # exec '???' # kill getppid # getppid diff --git a/t/op/taint.t b/t/op/taint.t index e25d4e0ef0..d75bc1807a 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -35,7 +35,7 @@ if ($Is_VMS) { END { \$ENV{PATH} = ''; warn "# Note: logical name 'PATH' may have been deleted\n"; - @ENV{keys %old} = values %old; + \@ENV{keys %old} = values %old; } EndOfCleanup } diff --git a/t/pod/emptycmd.t b/t/pod/emptycmd.t new file mode 100755 index 0000000000..59e395ea04 --- /dev/null +++ b/t/pod/emptycmd.t @@ -0,0 +1,21 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + +__END__ + +=pod + += this is a test +of the emergency +broadcast system + +=cut diff --git a/t/pod/emptycmd.xr b/t/pod/emptycmd.xr new file mode 100644 index 0000000000..f06d2dbb09 --- /dev/null +++ b/t/pod/emptycmd.xr @@ -0,0 +1,2 @@ + = this is a test of the emergency broadcast system + diff --git a/t/pod/for.t b/t/pod/for.t new file mode 100755 index 0000000000..44af44f17d --- /dev/null +++ b/t/pod/for.t @@ -0,0 +1,59 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=pod + +This is a test + +=for theloveofpete +You shouldn't see this +or this +or this + +=for text +pod2text should see this +and this +and this + +and everything should see this! + +=begin text + +Similarly, this line ... + +and this one ... + +as well this one, + +should all be in pod2text output + +=end text + +Tweedley-deedley-dee, Im as happy as can be! +Tweedley-deedley-dum, cuz youre my honey sugar plum! + +=begin atthebeginning + +But I expect to see neither hide ... + +nor tail ... + +of this text + +=end atthebeginning + +The rest of this should show up in everything. + diff --git a/t/pod/for.xr b/t/pod/for.xr new file mode 100644 index 0000000000..25794ab0fe --- /dev/null +++ b/t/pod/for.xr @@ -0,0 +1,19 @@ + This is a test + + pod2text should see this and this and this + + and everything should see this! + + Similarly, this line ... + + and this one ... + + as well this one, + + should all be in pod2text output + + Tweedley-deedley-dee, Im as happy as can be! Tweedley-deedley- + dum, cuz youre my honey sugar plum! + + The rest of this should show up in everything. + diff --git a/t/pod/headings.t b/t/pod/headings.t new file mode 100755 index 0000000000..78608d0fd9 --- /dev/null +++ b/t/pod/headings.t @@ -0,0 +1,140 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +################################################################# + use Pod::Usage; + pod2usage( VERBOSE => 2, EXIT => 1 ); + +=pod + +=head1 NAME + +B<rdb2pg> - insert an rdb table into a PostgreSQL database + +=head1 SYNOPSIS + +B<rdb2pg> [I<param>=I<value> ...] + +=head1 PARAMETERS + +B<rdb2pg> uses an IRAF-compatible parameter interface. +A template parameter file is in F</proj/axaf/simul/lib/uparm/rdb2pg.par>. + +=over 4 + +=item B<input> I<file> + +The B<RDB> file to insert into the database. If the given name +is the string C<stdin>, it reads from the UNIX standard input stream. + + +=back + +=head1 DESCRIPTION + +B<rdb2pg> will enter the data from an B<RDB> database into a +PostgreSQL database table, optionally creating the database and the +table if they do not exist. It automatically determines the +PostgreSQL data type from the column definition in the B<RDB> file, +but may be overriden via a series of definition files or directly +via one of its parameters. + +The target database and table are specified by the C<db> and C<table> +parameters. If they do not exist, and the C<createdb> parameter is +set, they will be created. Table field definitions are determined +in the following order: + +=cut + +################################################################# + +results in: + + +################################################################# + + rdb2pg - insert an rdb table into a PostgreSQL database + + rdb2pg [*param*=*value* ...] + + rdb2pg uses an IRAF-compatible parameter interface. A template + parameter file is in /proj/axaf/simul/lib/uparm/rdb2pg.par. + + The RDB file to insert into the database. If the given name is + the string `stdin', it reads from the UNIX standard input + stream. + + rdb2pg will enter the data from an RDB database into a + PostgreSQL database table, optionally creating the database and + the table if they do not exist. It automatically determines the + PostgreSQL data type from the column definition in the RDB file, + but may be overriden via a series of definition files or + directly via one of its parameters. + + The target database and table are specified by the `db' and + `table' parameters. If they do not exist, and the `createdb' + parameter is set, they will be created. Table field definitions + are determined in the following order: + + +################################################################# + +while the original version of Text (using pod2text) gives + +################################################################# + +NAME + rdb2pg - insert an rdb table into a PostgreSQL database + +SYNOPSIS + rdb2pg [*param*=*value* ...] + +PARAMETERS + rdb2pg uses an IRAF-compatible parameter interface. A template + parameter file is in /proj/axaf/simul/lib/uparm/rdb2pg.par. + + input *file* + The RDB file to insert into the database. If the given name + is the string `stdin', it reads from the UNIX standard input + stream. + +DESCRIPTION + rdb2pg will enter the data from an RDB database into a + PostgreSQL database table, optionally creating the database and + the table if they do not exist. It automatically determines the + PostgreSQL data type from the column definition in the RDB file, + but may be overriden via a series of definition files or + directly via one of its parameters. + + The target database and table are specified by the `db' and + `table' parameters. If they do not exist, and the `createdb' + parameter is set, they will be created. Table field definitions + are determined in the following order: + + +################################################################# + + +Thanks for any help. If, as your email indicates, you've not much +time to look at this, I can work around things by calling pod2text() +directly using the official Text.pm. + +Diab + +------------- +Diab Jerius +djerius@cfa.harvard.edu + diff --git a/t/pod/headings.xr b/t/pod/headings.xr new file mode 100644 index 0000000000..e1277b7e37 --- /dev/null +++ b/t/pod/headings.xr @@ -0,0 +1,29 @@ +NAME + rdb2pg - insert an rdb table into a PostgreSQL database + +SYNOPSIS + rdb2pg [*param*=*value* ...] + +PARAMETERS + rdb2pg uses an IRAF-compatible parameter interface. A template + parameter file is in /proj/axaf/simul/lib/uparm/rdb2pg.par. + + input *file* + The RDB file to insert into the database. If the given name + is the string `stdin', it reads from the UNIX standard input + stream. + + +DESCRIPTION + rdb2pg will enter the data from an RDB database into a + PostgreSQL database table, optionally creating the database and + the table if they do not exist. It automatically determines the + PostgreSQL data type from the column definition in the RDB file, + but may be overriden via a series of definition files or + directly via one of its parameters. + + The target database and table are specified by the `db' and + `table' parameters. If they do not exist, and the `createdb' + parameter is set, they will be created. Table field definitions + are determined in the following order: + diff --git a/t/pod/include.t b/t/pod/include.t new file mode 100755 index 0000000000..4e73b78356 --- /dev/null +++ b/t/pod/include.t @@ -0,0 +1,36 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=pod + +This file tries to demonstrate a simple =include directive +for pods. It is used as follows: + + =include filename + +where "filename" is expected to be an absolute pathname, or else +reside be relative to the directory in which the current processed +podfile resides, or be relative to the current directory. + +Lets try it out with the file "included.t" shall we. + +***THIS TEXT IS IMMEDIATELY BEFORE THE INCLUDE*** + +=include included.t + +***THIS TEXT IS IMMEDIATELY AFTER THE INCLUDE*** + +So how did we do??? diff --git a/t/pod/include.xr b/t/pod/include.xr new file mode 100644 index 0000000000..1bac06adb1 --- /dev/null +++ b/t/pod/include.xr @@ -0,0 +1,23 @@ + This file tries to demonstrate a simple =include directive for + pods. It is used as follows: + + =include filename + + where "filename" is expected to be an absolute pathname, or else + reside be relative to the directory in which the current + processed podfile resides, or be relative to the current + directory. + + Lets try it out with the file "included.t" shall we. + + ***THIS TEXT IS IMMEDIATELY BEFORE THE INCLUDE*** + +###### begin =include included.t ##### + This is the text of the included file named "included.t". It + should appear in the final pod document from pod2xxx + +###### end =include included.t ##### + ***THIS TEXT IS IMMEDIATELY AFTER THE INCLUDE*** + + So how did we do??? + diff --git a/t/pod/included.t b/t/pod/included.t new file mode 100755 index 0000000000..4f171c454b --- /dev/null +++ b/t/pod/included.t @@ -0,0 +1,35 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +##------------------------------------------------------------ +# This file is =included by "include.t" +# +# This text should NOT be in the resultant pod document +# because we havent seen an =xxx pod directive in this file! +##------------------------------------------------------------ + +=pod + +This is the text of the included file named "included.t". +It should appear in the final pod document from pod2xxx + +=cut + +##------------------------------------------------------------ +# This text should NOT be in the resultant pod document +# because it is *after* an =cut an no other pod directives +# proceed it! +##------------------------------------------------------------ diff --git a/t/pod/included.xr b/t/pod/included.xr new file mode 100644 index 0000000000..f0bc03bf09 --- /dev/null +++ b/t/pod/included.xr @@ -0,0 +1,3 @@ + This is the text of the included file named "included.t". It + should appear in the final pod document from pod2xxx + diff --git a/t/pod/lref.t b/t/pod/lref.t new file mode 100755 index 0000000000..02e2c9e307 --- /dev/null +++ b/t/pod/lref.t @@ -0,0 +1,66 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=pod + +Try out I<LOTS> of different ways of specifying references: + +Reference the L<manpage/section> + +Reference the L<manpage / section> + +Reference the L<manpage/ section> + +Reference the L<manpage /section> + +Reference the L<"manpage/section"> + +Reference the L<"manpage"/section> + +Reference the L<manpage/"section"> + +Reference the L<manpage/ +section> + +Reference the L<manpage +/section> + +Now try it using the new "|" stuff ... + +Reference the L<thistext|manpage/section> + +Reference the L<thistext | manpage / section> + +Reference the L<thistext| manpage/ section> + +Reference the L<thistext |manpage /section> + +Reference the L<thistext| +"manpage/section"> + +Reference the L<thistext +|"manpage"/section> + +Reference the L<thistext|manpage/"section"> + +Reference the L<thistext| +manpage/ +section> + +Reference the L<thistext +|manpage +/section> + diff --git a/t/pod/lref.xr b/t/pod/lref.xr new file mode 100644 index 0000000000..d8455e3874 --- /dev/null +++ b/t/pod/lref.xr @@ -0,0 +1,40 @@ + Try out *LOTS* of different ways of specifying references: + + Reference the the "section" entry in the manpage manpage + + Reference the the "section" entry in the manpage manpage + + Reference the the "section" entry in the manpage manpage + + Reference the the "section" entry in the manpage manpage + + Reference the the section on "manpage/section" + + Reference the the "section" entry in the "manpage" manpage + + Reference the the section on "section" in the manpage manpage + + Reference the the "section" entry in the manpage manpage + + Reference the the "section" entry in the manpage manpage + + Now try it using the new "|" stuff ... + + Reference the thistext + + Reference the thistext + + Reference the thistext + + Reference the thistext + + Reference the thistext + + Reference the thistext + + Reference the thistext + + Reference the thistext + + Reference the thistext + diff --git a/t/pod/nested_items.t b/t/pod/nested_items.t new file mode 100755 index 0000000000..c8e9b22427 --- /dev/null +++ b/t/pod/nested_items.t @@ -0,0 +1,64 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=head1 Test nested item lists + +This is a test to ensure the nested =item paragraphs +get indented appropriately. + +=over 2 + +=item 1 + +First section. + +=over 2 + +=item a + +this is item a + +=item b + +this is item b + +=back + +=item 2 + +Second section. + +=over 2 + +=item a + +this is item a + +=item b + +this is item b + +=item c + +=item d + +This is item c & d. + +=back + +=back + +=cut diff --git a/t/pod/nested_items.xr b/t/pod/nested_items.xr new file mode 100644 index 0000000000..7d72bbe890 --- /dev/null +++ b/t/pod/nested_items.xr @@ -0,0 +1,19 @@ +Test nested item lists + This is a test to ensure the nested =item paragraphs get + indented appropriately. + + 1 First section. + + a this is item a + + b this is item b + + 2 Second section. + + a this is item a + + b this is item b + + c + d This is item c & d. + diff --git a/t/pod/nested_seqs.t b/t/pod/nested_seqs.t new file mode 100755 index 0000000000..8559f1f25f --- /dev/null +++ b/t/pod/nested_seqs.t @@ -0,0 +1,23 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=pod + +The statement: C<This is dog kind's I<finest> hour!> is a parody of a +quotation from Winston Churchill. + +=cut + diff --git a/t/pod/nested_seqs.xr b/t/pod/nested_seqs.xr new file mode 100644 index 0000000000..5a008c17e9 --- /dev/null +++ b/t/pod/nested_seqs.xr @@ -0,0 +1,3 @@ + The statement: `This is dog kind's *finest* hour!' is a parody + of a quotation from Winston Churchill. + diff --git a/t/pod/oneline_cmds.t b/t/pod/oneline_cmds.t new file mode 100755 index 0000000000..28bd1d09e5 --- /dev/null +++ b/t/pod/oneline_cmds.t @@ -0,0 +1,46 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +==head1 NAME +B<rdb2pg> - insert an rdb table into a PostgreSQL database + +==head1 SYNOPSIS +B<rdb2pg> [I<param>=I<value> ...] + +==head1 PARAMETERS +B<rdb2pg> uses an IRAF-compatible parameter interface. +A template parameter file is in F</proj/axaf/simul/lib/uparm/rdb2pg.par>. + +==over 4 +==item B<input> I<file> +The B<RDB> file to insert into the database. If the given name +is the string C<stdin>, it reads from the UNIX standard input stream. + +==back + +==head1 DESCRIPTION +B<rdb2pg> will enter the data from an B<RDB> database into a +PostgreSQL database table, optionally creating the database and the +table if they do not exist. It automatically determines the +PostgreSQL data type from the column definition in the B<RDB> file, +but may be overriden via a series of definition files or directly +via one of its parameters. + +The target database and table are specified by the C<db> and C<table> +parameters. If they do not exist, and the C<createdb> parameter is +set, they will be created. Table field definitions are determined +in the following order: + diff --git a/t/pod/oneline_cmds.xr b/t/pod/oneline_cmds.xr new file mode 100644 index 0000000000..e1277b7e37 --- /dev/null +++ b/t/pod/oneline_cmds.xr @@ -0,0 +1,29 @@ +NAME + rdb2pg - insert an rdb table into a PostgreSQL database + +SYNOPSIS + rdb2pg [*param*=*value* ...] + +PARAMETERS + rdb2pg uses an IRAF-compatible parameter interface. A template + parameter file is in /proj/axaf/simul/lib/uparm/rdb2pg.par. + + input *file* + The RDB file to insert into the database. If the given name + is the string `stdin', it reads from the UNIX standard input + stream. + + +DESCRIPTION + rdb2pg will enter the data from an RDB database into a + PostgreSQL database table, optionally creating the database and + the table if they do not exist. It automatically determines the + PostgreSQL data type from the column definition in the RDB file, + but may be overriden via a series of definition files or + directly via one of its parameters. + + The target database and table are specified by the `db' and + `table' parameters. If they do not exist, and the `createdb' + parameter is set, they will be created. Table field definitions + are determined in the following order: + diff --git a/t/pod/poderrs.t b/t/pod/poderrs.t new file mode 100755 index 0000000000..591bd2a86d --- /dev/null +++ b/t/pod/poderrs.t @@ -0,0 +1,39 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testpchk.pl"; + import TestPodChecker; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodchecker \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=head1 NAME + +poderrors.t - test Pod::Checker on some pod syntax errors + +=unknown1 this is an unknown command with two N<unknownA> +and D<unknownB> interior sequences. + +This is some paragraph text with some unknown interior sequences, +such as Q<unknown2>, +A<unknown3>, +and Y<unknown4 V<unknown5>>. + +Now try some unterminated sequences like +I<hello mudda! +B<hello fadda! + +Here I am at C<camp granada! + +Camps is very, +entertaining. +And they say we'll have some fun if it stops raining! + +=cut diff --git a/t/pod/poderrs.xr b/t/pod/poderrs.xr new file mode 100644 index 0000000000..a7bc42d956 --- /dev/null +++ b/t/pod/poderrs.xr @@ -0,0 +1,11 @@ +*** ERROR: Unknown command "unknown1" at line 21 of file t/poderrs.t +*** ERROR: Unknown interior-sequence "N" at line 21 of file t/poderrs.t +*** ERROR: Unknown interior-sequence "D" at line 22 of file t/poderrs.t +*** ERROR: Unknown interior-sequence "Q" at line 25 of file t/poderrs.t +*** ERROR: Unknown interior-sequence "A" at line 26 of file t/poderrs.t +*** ERROR: Unknown interior-sequence "V" at line 27 of file t/poderrs.t +*** ERROR: Unknown interior-sequence "Y" at line 27 of file t/poderrs.t +** Unterminated B<...> at t/poderrs.t line 31 +** Unterminated I<...> at t/poderrs.t line 30 +** Unterminated C<...> at t/poderrs.t line 33 +t/poderrs.t has 10 pod syntax errors. diff --git a/t/pod/special_seqs.t b/t/pod/special_seqs.t new file mode 100755 index 0000000000..5352fd1ca6 --- /dev/null +++ b/t/pod/special_seqs.t @@ -0,0 +1,30 @@ +BEGIN { + use File::Basename; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testp2pt.pl"; + import TestPodIncPlainText; +} + +my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash +my $passed = testpodplaintext \%options, $0; +exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE}; + + +__END__ + + +=pod + +This is a test to see if I can do not only C<$self> and C<method()>, but +also C<$self->method()> and C<$self->{FIELDNAME}> and C<{FOO=>BAR}> without +resorting to escape sequences. + +Now for the grand finale of C<$self->method()->{FIELDNAME} = {FOO=>BAR}>. + +Of course I should still be able to do all this I<with> escape sequences +too: C<$self-E<gt>method()> and C<$self-E<gt>{FIELDNAME}> and C<{FOO=E<gt>BAR}>. + +Dont forget C<$self-E<gt>method()-E<gt>{FIELDNAME} = {FOO=E<gt>BAR}>. + +=cut diff --git a/t/pod/special_seqs.xr b/t/pod/special_seqs.xr new file mode 100644 index 0000000000..b6ae7fd5b6 --- /dev/null +++ b/t/pod/special_seqs.xr @@ -0,0 +1,13 @@ + This is a test to see if I can do not only `$self' and + `method()', but also `$self->method()' and `$self->{FIELDNAME}' + and `{FOO=>BAR}' without resorting to escape sequences. + + Now for the grand finale of `$self->method()->{FIELDNAME} = + {FOO=>BAR}'. + + Of course I should still be able to do all this *with* escape + sequences too: `$self->method()' and `$self->{FIELDNAME}' and + `{FOO=>BAR}'. + + Dont forget `$self->method()->{FIELDNAME} = {FOO=>BAR}'. + diff --git a/t/pod/testcmp.pl b/t/pod/testcmp.pl new file mode 100644 index 0000000000..d61bbff3a2 --- /dev/null +++ b/t/pod/testcmp.pl @@ -0,0 +1,90 @@ +package TestCompare; + +use vars qw(@ISA @EXPORT $MYPKG); +#use strict; +#use diagnostics; +use Carp; +use Exporter; +use File::Basename; +use File::Spec; + +@ISA = qw(Exporter); +@EXPORT = qw(&testcmp); +$MYPKG = eval { (caller)[0] }; + +##-------------------------------------------------------------------------- + +=head1 NAME + +testcmp -- compare two files line-by-line + +=head1 SYNOPSIS + + $is_diff = testcmp($file1, $file2); + +or + + $is_diff = testcmp({-cmplines => \&mycmp}, $file1, $file2); + +=head2 DESCRIPTION + +Compare two text files line-by-line and return 0 if they are the +same, 1 if they differ. Each of $file1 and $file2 may be a filenames, +or a filehandles (in which case it must already be open for reading). + +If the first argument is a hashref, then the B<-cmplines> key in the +hash may have a subroutine reference as its corresponding value. +The referenced user-defined subroutine should be a line-comparator +function that takes two pre-chomped text-lines as its arguments +(the first is from $file1 and the second is from $file2). It should +return 0 if it considers the two lines equivalent, and non-zero +otherwise. + +=cut + +##-------------------------------------------------------------------------- + +sub testcmp( $ $ ; $) { + my %opts = ref($_[0]) eq 'HASH' ? %{shift()} : (); + my ($file1, $file2) = @_; + my ($fh1, $fh2) = ($file1, $file2); + unless (ref $fh1) { + $fh1 = FileHandle->new($file1, "r") or die "Can't open $file1: $!"; + } + unless (ref $fh2) { + $fh2 = FileHandle->new($file2, "r") or die "Can't open $file2: $!"; + } + + my $cmplines = $opts{'-cmplines'} || undef; + my ($f1text, $f2text) = ("", ""); + my ($line, $diffs) = (0, 0); + + while ( defined($f1text) and defined($f2text) ) { + defined($f1text = <$fh1>) and chomp($f1text); + defined($f2text = <$fh2>) and chomp($f2text); + ++$line; + last unless ( defined($f1text) and defined($f2text) ); + $diffs = (ref $cmplines) ? &$cmplines($f1text, $f2text) + : ($f1text ne $f2text); + last if $diffs; + } + close($fh1) unless (ref $file1); + close($fh2) unless (ref $file2); + + $diffs = 1 if (defined($f1text) or defined($f2text)); + if ( defined($f1text) and defined($f2text) ) { + ## these two lines must be different + warn "$file1 and $file2 differ at line $line\n"; + } + elsif (defined($f1text) and (! defined($f1text))) { + ## file1 must be shorter + warn "$file1 is shorter than $file2\n"; + } + elsif (defined $f2text) { + ## file2 must be longer + warn "$file1 is shorter than $file2\n"; + } + return $diffs; +} + +1; diff --git a/t/pod/testp2pt.pl b/t/pod/testp2pt.pl new file mode 100644 index 0000000000..140de05a3a --- /dev/null +++ b/t/pod/testp2pt.pl @@ -0,0 +1,177 @@ +package TestPodIncPlainText; + +BEGIN { + use File::Basename; + use File::Spec; + push @INC, '..'; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testcmp.pl"; + import TestCompare; + my $PARENTDIR = dirname $THISDIR; + push @INC, map { File::Spec->catfile($_, 'lib') } ($PARENTDIR, $THISDIR); +} + +use Pod::PlainText; +use vars qw(@ISA @EXPORT $MYPKG); +#use strict; +#use diagnostics; +use Carp; +use Exporter; +#use File::Compare; + +@ISA = qw(Pod::PlainText); +@EXPORT = qw(&testpodplaintext); +$MYPKG = eval { (caller)[0] }; + +## Hardcode settings for TERMCAP and COLUMNS so we can try to get +## reproducible results between environments +@ENV{qw(TERMCAP COLUMNS)} = ('co=72:do=^J', 72); + +sub catfile(@) { File::Spec->catfile(@_); } + +## Find the path to the file to =include +sub findinclude { + my $self = shift; + my $incname = shift; + + ## See if its already found w/out any "searching; + return $incname if (-r $incname); + + ## Need to search for it. Look in the following directories ... + ## 1. the directory containing this pod file + my $thispoddir = dirname $self->input_file; + ## 2. the parent directory of the above + my $parentdir = ($thispoddir eq '.') ? '..' : dirname $thispoddir; + ## 3. any Pod/ or scripts/ subdirectory of these two + my @dirs = (); + for ($thispoddir, $parentdir) { + my $dir = $_; + for ( qw(scripts lib) ) { + push @dirs, $dir, catfile($dir, $_), + catfile($dir, 'Pod'), + catfile($dir, $_, 'Pod'); + } + } + my %dirs = (map { ($_ => 1) } @dirs); + my @podincdirs = (sort keys %dirs); + + for (@podincdirs) { + my $incfile = catfile($_, $incname); + return $incfile if (-r $incfile); + } + warn("*** Can't find =include file $incname in @podincdirs\n"); + return ""; +} + +sub command { + my $self = shift; + my ($cmd, $text, $line_num, $pod_para) = @_; + $cmd = '' unless (defined $cmd); + local $_ = $text || ''; + my $out_fh = $self->output_handle; + + ## Defer to the superclass for everything except '=include' + return $self->SUPER::command(@_) unless ($cmd eq "include"); + + ## We have an '=include' command + my $incdebug = 1; ## debugging + my @incargs = split; + if (@incargs == 0) { + warn("*** No filename given for '=include'\n"); + return; + } + my $incfile = $self->findinclude(shift @incargs) or return; + my $incbase = basename $incfile; + print $out_fh "###### begin =include $incbase #####\n" if ($incdebug); + $self->parse_from_file( {-cutting => 1}, $incfile ); + print $out_fh "###### end =include $incbase #####\n" if ($incdebug); +} + +sub podinc2plaintext( $ $ ) { + my ($infile, $outfile) = @_; + local $_; + my $text_parser = $MYPKG->new; + $text_parser->parse_from_file($infile, $outfile); +} + +sub testpodinc2plaintext( @ ) { + my %args = @_; + my $infile = $args{'-In'} || croak "No input file given!"; + my $outfile = $args{'-Out'} || croak "No output file given!"; + my $cmpfile = $args{'-Cmp'} || croak "No compare-result file given!"; + + my $different = ''; + my $testname = basename $cmpfile, '.t', '.xr'; + + unless (-e $cmpfile) { + my $msg = "*** Can't find comparison file $cmpfile for testing $infile"; + warn "$msg\n"; + return $msg; + } + + print "+ Running testpodinc2plaintext for '$testname'...\n"; + ## Compare the output against the expected result + podinc2plaintext($infile, $outfile); + if ( testcmp($outfile, $cmpfile) ) { + $different = "$outfile is different from $cmpfile"; + } + else { + unlink($outfile); + } + return $different; +} + +sub testpodplaintext( @ ) { + my %opts = (ref $_[0] eq 'HASH') ? %{shift()} : (); + my @testpods = @_; + my ($testname, $testdir) = ("", ""); + my ($podfile, $cmpfile) = ("", ""); + my ($outfile, $errfile) = ("", ""); + my $passes = 0; + my $failed = 0; + local $_; + + print "1..", scalar @testpods, "\n" unless ($opts{'-xrgen'}); + + for $podfile (@testpods) { + ($testname, $_) = fileparse($podfile); + $testdir ||= $_; + $testname =~ s/\.t$//; + $cmpfile = $testdir . $testname . '.xr'; + $outfile = $testdir . $testname . '.OUT'; + + if ($opts{'-xrgen'}) { + if ($opts{'-force'} or ! -e $cmpfile) { + ## Create the comparison file + print "+ Creating expected result for \"$testname\"" . + " pod2plaintext test ...\n"; + podinc2plaintext($podfile, $cmpfile); + } + else { + print "+ File $cmpfile already exists" . + " (use '-force' to regenerate it).\n"; + } + next; + } + + my $failmsg = testpodinc2plaintext + -In => $podfile, + -Out => $outfile, + -Cmp => $cmpfile; + if ($failmsg) { + ++$failed; + print "+\tFAILED. ($failmsg)\n"; + print "not ok ", $failed+$passes, "\n"; + } + else { + ++$passes; + unlink($outfile); + print "+\tPASSED.\n"; + print "ok ", $failed+$passes, "\n"; + } + } + return $passes; +} + +1; diff --git a/t/pod/testpchk.pl b/t/pod/testpchk.pl new file mode 100644 index 0000000000..cd3c13816d --- /dev/null +++ b/t/pod/testpchk.pl @@ -0,0 +1,129 @@ +package TestPodChecker; + +BEGIN { + use File::Basename; + use File::Spec; + push @INC, '..'; + my $THISDIR = dirname $0; + unshift @INC, $THISDIR; + require "testcmp.pl"; + import TestCompare; + my $PARENTDIR = dirname $THISDIR; + push @INC, map { File::Spec->catfile($_, 'lib') } ($PARENTDIR, $THISDIR); +} + +use Pod::Checker; +use vars qw(@ISA @EXPORT $MYPKG); +#use strict; +#use diagnostics; +use Carp; +use Exporter; +#use File::Compare; + +@ISA = qw(Exporter); +@EXPORT = qw(&testpodchecker); +$MYPKG = eval { (caller)[0] }; + +sub stripname( $ ) { + local $_ = shift; + return /(\w[.\w]*)\s*$/ ? $1 : $_; +} + +sub msgcmp( $ $ ) { + ## filter out platform-dependent aspects of error messages + my ($line1, $line2) = @_; + for ($line1, $line2) { + if ( /^#*\s*(\S.*?)\s+(?:has \d+\s*)?pod syntax (?:error|OK)/ ) { + my $fname = $1; + s/^#*\s*// if ($^O eq 'MacOS'); + s/^\s*\Q$fname\E/stripname($fname)/e; + } + elsif ( /^#*\s*\*+\s*(?:ERROR|Unterminated)/ ) { + s/^#*\s*// if ($^O eq 'MacOS'); + s/of file\s+(\S.*?)\s*$/"of file ".stripname($1)/e; + s/at\s+(\S.*?)\s+line/"at ".stripname($1)." line"/e; + } + } + return $line1 ne $line2; +} + +sub testpodcheck( @ ) { + my %args = @_; + my $infile = $args{'-In'} || croak "No input file given!"; + my $outfile = $args{'-Out'} || croak "No output file given!"; + my $cmpfile = $args{'-Cmp'} || croak "No compare-result file given!"; + + my $different = ''; + my $testname = basename $cmpfile, '.t', '.xr'; + + unless (-e $cmpfile) { + my $msg = "*** Can't find comparison file $cmpfile for testing $infile"; + warn "$msg\n"; + return $msg; + } + + print "+ Running podchecker for '$testname'...\n"; + ## Compare the output against the expected result + podchecker($infile, $outfile); + if ( testcmp({'-cmplines' => \&msgcmp}, $outfile, $cmpfile) ) { + $different = "$outfile is different from $cmpfile"; + } + else { + unlink($outfile); + } + return $different; +} + +sub testpodchecker( @ ) { + my %opts = (ref $_[0] eq 'HASH') ? %{shift()} : (); + my @testpods = @_; + my ($testname, $testdir) = ("", ""); + my ($podfile, $cmpfile) = ("", ""); + my ($outfile, $errfile) = ("", ""); + my $passes = 0; + my $failed = 0; + local $_; + + print "1..", scalar @testpods, "\n" unless ($opts{'-xrgen'}); + + for $podfile (@testpods) { + ($testname, $_) = fileparse($podfile); + $testdir ||= $_; + $testname =~ s/\.t$//; + $cmpfile = $testdir . $testname . '.xr'; + $outfile = $testdir . $testname . '.OUT'; + + if ($opts{'-xrgen'}) { + if ($opts{'-force'} or ! -e $cmpfile) { + ## Create the comparison file + print "+ Creating expected result for \"$testname\"" . + " podchecker test ...\n"; + podchecker($podfile, $cmpfile); + } + else { + print "+ File $cmpfile already exists" . + " (use '-force' to regenerate it).\n"; + } + next; + } + + my $failmsg = testpodcheck + -In => $podfile, + -Out => $outfile, + -Cmp => $cmpfile; + if ($failmsg) { + ++$failed; + print "+\tFAILED. ($failmsg)\n"; + print "not ok ", $failed+$passes, "\n"; + } + else { + ++$passes; + unlink($outfile); + print "+\tPASSED.\n"; + print "ok ", $failed+$passes, "\n"; + } + } + return $passes; +} + +1; diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t new file mode 100755 index 0000000000..e5b3bb5cd3 --- /dev/null +++ b/t/pragma/utf8.t @@ -0,0 +1,37 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + unshift @INC, '../lib'; + $ENV{PERL5LIB} = '../lib'; +} + +print "1..3\n"; + +my $test = 1; + +sub ok { + my ($got,$expect) = @_; + print "# expected [$expect], got [$got]\nnot " if $got ne $expect; + print "ok $test\n"; +} + +{ + use utf8; + $_ = ">\x{263A}<"; + s/([\x{80}-\x{10ffff}])/"&#".ord($1).";"/eg; + ok $_, '>☺<'; + $test++; + + $_ = ">\x{263A}<"; + my $rx = "\x{80}-\x{10ffff}"; + s/([$rx])/"&#".ord($1).";"/eg; + ok $_, '>☺<'; + $test++; + + $_ = ">\x{263A}<"; + my $rx = "\\x{80}-\\x{10ffff}"; + s/([$rx])/"&#".ord($1).";"/eg; + ok $_, '>☺<'; + $test++; +} diff --git a/t/pragma/warn/util b/t/pragma/warn/util index b63f89e139..d58f4b70fa 100644 --- a/t/pragma/warn/util +++ b/t/pragma/warn/util @@ -14,16 +14,16 @@ __END__ use warning 'octal' ; my $a = oct "029" ; EXPECT -Illegal octal digit ignored at - line 3. +Illegal octal digit '9' ignored at - line 3. ######## # util.c use warning 'unsafe' ; *a = hex "0xv9" ; EXPECT -Illegal hex digit ignored at - line 3. +Illegal hex digit 'v' ignored at - line 3. ######## # util.c use warning 'unsafe' ; *a = oct "0b9" ; EXPECT -Illegal binary digit ignored at - line 3. +Illegal binary digit '9' ignored at - line 3. |