| 1 | # pmtools testing |
| 2 | |
| 3 | # ------ pragmas |
| 4 | use strict; |
| 5 | use warnings; |
| 6 | use pmtools; |
| 7 | use Test::More tests => 7; |
| 8 | |
| 9 | # ------ define variable |
| 10 | my $output = undef; # output from pmtools |
| 11 | |
| 12 | my $iter = pmtools::new_pod_iterator('quux'); |
| 13 | is(ref $iter, 'CODE', 'created a pmtools iterator'); |
| 14 | is($iter->(), "$INC[0]/pod/quux.pod", "first POD file, first \@INC"); |
| 15 | is($iter->(), "$INC[0]/quux.pod", "middle POD file, first \@INC"); |
| 16 | is($iter->(), "$INC[0]/quux.pm", "last POD file, first \@INC"); |
| 17 | |
| 18 | my $old_pod_file; |
| 19 | my $pod_file; |
| 20 | while ($pod_file = $iter->()) { |
| 21 | $old_pod_file = $pod_file; |
| 22 | } |
| 23 | is($old_pod_file, "$INC[$#INC]/quux.pm", 'last POD file, last @INC'); |
| 24 | |
| 25 | is($pod_file, undef, 'beyond end of filenames'); |
| 26 | is($iter->(), undef, 'way beyond end of filenames'); |