Subject: | no working spellchecker found |
If something goes wrong, the test issues message "no working spellchecker found" and skips. It is very hard to understand what is going wrong. The test should be more talkative. I mean it should show spellchecker commands and error messages, at least in verbose mode.
Proposed patch implements such approach. In normal mode output is the same as before. In verbose mode output looks like:
xt/author/pod-spell.t .....
# Unable to find a working spellchecker:
# Unable to run 'spell':
# No such file or directory at Test/Spelling.pm line 67.
# Unable to run 'aspell list -l en -p /dev/null':
# No such file or directory at Test/Spelling.pm line 67.
# Unable to run 'ispell -l':
# No such file or directory at Test/Spelling.pm line 67.
# Unable to run 'hunspell -l':
# No such file or directory at Test/Spelling.pm line 67.
1..0 # SKIP no working spellchecker found
skipped: no working spellchecker found
It also helps if custom spellchecker is specified:
xt/author/pod-spell.t .....
# Unable to find a working spellchecker:
# Unable to run 'aspell list -l en -p ./.wordlist':
# Error: The file "./.wordlist" is not in the proper format.
1..0 # SKIP no working spellchecker found
skipped: no working spellchecker found
Subject: | Spelling.pm.patch |
--- Spelling.pm.ORIG 2014-10-07 17:48:27.000000000 +0400
+++ Spelling.pm 2015-07-06 01:02:35.982965582 +0300
@@ -68,7 +68,7 @@
@words = split /\n/, $spellcheck_results;
- die "spellchecker had errors: $errors" if length $errors;
+ die "$errors" if length $errors;
1;
};
@@ -83,17 +83,19 @@
return @words;
}
- push @errors, "Unable to run '$spellchecker': $@";
+ push @errors, " Unable to run '$spellchecker':\n", map { " $_\n" } split("\n", $@);
}
- # no working spellcheckers during a dry run
- return \"no spellchecker" if $dryrun;
-
# no working spellcheckers; report all the errors
- require Carp;
- Carp::croak
- "Unable to find a working spellchecker:\n"
- . join("\n", map { " $_\n" } @errors)
+ my $msg = "Unable to find a working spellchecker:\n" . join("", @errors);
+ if ( $dryrun ) {
+ $TEST->note($msg);
+ # no working spellcheckers during a dry run
+ return \"no spellchecker";
+ } else {
+ require Carp;
+ Carp::croak($msg);
+ };
}
sub invalid_words_in {