diff --git a/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash b/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash index 0cc7ede8e38..5aa267a5888 100755 --- a/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash +++ b/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash @@ -17,6 +17,9 @@ if [[ "$HOME" == '' ]] ; then exit 3 fi +dictionary=UNSET +repl=UNSET + show_vv() { printf '%s\n' "@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.0)" @@ -94,11 +97,24 @@ while :; do exit ;; -a) # imitate REPL - imitate_pipe - exit + repl=pipe ;; + -d) + if [ "$2" ]; then + dictionary=$2 + if [[ "$dictionary" == "2110001888290146229" ]] ; then exit 3 ; fi + shift + else + printf 'ERROR: "-d" requires an argument.' 1>&2 + exit 1 + fi + ;; + -d*) + dictionary=${1#-d} + if [[ "$dictionary" == "2110001888290146229" ]] ; then exit 3 ; fi + ;; -?*) - printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2 + : ;; *) break @@ -106,6 +122,11 @@ while :; do shift done -printf 'Usage: aspell [options] \n' +if [[ "$repl" == "pipe" ]] ; then + imitate_pipe +else + printf 'Usage: aspell [options] \n' + exit 4 +fi #printf 'this place should be unreachable\n' >> /tmp/lwf_mock-aspell.log diff --git a/test/lisp/textmodes/ispell-tests/ispell-tests-common.el b/test/lisp/textmodes/ispell-tests/ispell-tests-common.el index 30a4336f094..4bf3a79b769 100644 --- a/test/lisp/textmodes/ispell-tests/ispell-tests-common.el +++ b/test/lisp/textmodes/ispell-tests/ispell-tests-common.el @@ -37,15 +37,14 @@ "Path to the mock backend.") -(let* ((backend-binaries (list "ispell" "aspell" "hunspell" "enchant-2" fake-aspell-path) - ) +(let* ((backend-binaries (list "ispell" "aspell" "hunspell" "enchant-2" fake-aspell-path)) (filter-binaries (seq-filter (lambda (b) (and (executable-find b) (equal 0 (with-temp-buffer - (call-process b nil t "-a"))))) + (call-process b nil t nil "-a"))))) backend-binaries))) (defun ispell-tests--some-backend-available-p () @@ -86,7 +85,8 @@ (forward-line 1) (let* ((s (buffer-substring (point) (line-end-position)))) (file-name-sans-extension - (file-name-nondirectory s))))))) + (file-name-nondirectory s))))) + (t "english"))) (eval-when-compile (require 'cl-macs)) @@ -140,6 +140,7 @@ its best." (defconst ispell-tests--constants/russian/correct "привет") (defconst ispell-tests--constants/russian/wrong "ыфаывфафыввпфыв") (defconst ispell-tests--constants/completion "waveguides") +(defconst ispell-tests--constants/nonexistent-dictionary "2110001888290146229") (provide 'ispell-tests-common) diff --git a/test/lisp/textmodes/ispell-tests/ispell-tests.el b/test/lisp/textmodes/ispell-tests/ispell-tests.el index 605b634e9a8..b43d32ae95d 100644 --- a/test/lisp/textmodes/ispell-tests/ispell-tests.el +++ b/test/lisp/textmodes/ispell-tests/ispell-tests.el @@ -836,14 +836,14 @@ hunspell. Hence skipping." (ert-deftest ispell/ispell-accept-buffer-local-defs/received-file () "Check that `ispell-accept-buffer-local-defs' is broken when a file has a nonexistent file-local dictionary. -We do not control this data, but this should make ispell.el failx." +We do not control this data, but this should make ispell.el fail." :expected-result :failed (with-environment-variables (("HOME" temporary-file-directory)) (with-temp-buffer (ispell-tests--letopt ((ispell-program-name (ispell-tests--some-backend))) - (let ((test-dictname (format "%s" (random)))) + (let ((test-dictname ispell-tests--constants/nonexistent-dictionary)) (insert (car ispell-tests--constants/english/correct-list) "\n\n\n" ispell-dictionary-keyword test-dictname "\n")