| 1 | # pmdesc testing |
| 2 | |
| 3 | # ------ pragmas |
| 4 | use strict; |
| 5 | use warnings; |
| 6 | use Test::More tests => 2; |
| 7 | |
| 8 | # ------ define variable |
| 9 | my $output_split = undef; |
| 10 | my $output_unified = undef; |
| 11 | |
| 12 | # ------ add pmtools to PATH for testing, so we use the current pmtools |
| 13 | $ENV{"PATH"} = 'blib/script:' . $ENV{"PATH"}; |
| 14 | |
| 15 | my $split; |
| 16 | my $unified; |
| 17 | |
| 18 | eval { |
| 19 | $output_unified = `bin/pmdesc Carp 2>&1`; |
| 20 | }; |
| 21 | $unified = $?; |
| 22 | |
| 23 | eval { |
| 24 | $output_split = `bin/pmdesc --splitpod Carp 2>&1`; |
| 25 | }; |
| 26 | $split = $?; |
| 27 | |
| 28 | if ($unified == 0 || $split == 0) { |
| 29 | is($?, 0, "pmdesc runs"); |
| 30 | } else { |
| 31 | fail('pmdesc fails to run'); |
| 32 | } |
| 33 | if ($output_unified =~ m/Carp\D+\(\d+\.\d+\)\s-\s\w/msx |
| 34 | || $output_split =~ m/Carp\D+\(\d+\.\d+\)\s-\s\w/msx) { |
| 35 | pass('described a module'); |
| 36 | } else { |
| 37 | fail('no description found by pmdesc'); |
| 38 | } |