Subject: bug#79177: 31.0.50; [PATCH] [v4] Add tests to ispell.el

From: Eli Zaretskii <[email-masked]>
Date: Thu, 07 Aug 2025 10:36:04 +0300

> Cc: Lockywolf <[email-masked]>
> From: Lockywolf <[email-masked]>
> Date: Thu, 07 Aug 2025 15:01:59 +0800
> 
> Updated version of the patch attached:

Thanks, comments below.

> >From a5a489689f5361c4a86749ac3c9b33e83b23e528 Mon Sep 17 00:00:00 2001
> From: Lockywolf <[email-masked]>
> Date: Thu, 24 Jul 2025 21:07:10 +0800
> Subject: [PATCH] ispell.el: Add 39 tests.
> 
> * test/lisp/textmodes/ispell-tests/*: Add 36 tests for basic utils
>   used in ispell.el.
>    ispell-program-name
>    ispell-with-safe-default-directory
>    ispell-call-process
>    ispell-create-debug-buffer
>    ispell-valid-dictionary-list
>    ispell-add-per-file-word-list
>    ispell-buffer-local-words
>    ispell-init-process
>    ispell-buffer-local-dict
> * test/lisp/textmodes/ispell-resources/fake-aspell: Add a mock
>   `aspell' for use in ispell.el test.

Please mention the bug number in the commit log message.

> diff --git a/test/lisp/textmodes/ispell-resources/fake-aspell.bash b/test/lisp/textmodes/ispell-resources/fake-aspell.bash
> new file mode 100755
> index 00000000000..4406a18a22e
> --- /dev/null
> +++ b/test/lisp/textmodes/ispell-resources/fake-aspell.bash
> @@ -0,0 +1,2 @@
> +#!/bin/bash
> +printf  '%s\n' "@(#) International Ispell Version 3.1.20 (but really Aspell 0.59.800)"

I asked to use Emacs instead of a Bash script?  If that causes
problems, let's discuss that, okay?

> +   (with-temp-buffer
> +     (let ((default-directory "86e44985-cfba-43ba-98dc-73be46addbc2"))
> +       (ispell-call-process "emacs" nil t nil '("--batch" "-q" "-nw" "--eval" "(progn (message default-directory) (kill-emacs))"))

There's no need for "-nw", "--batch" implies it.  Also, I suggest to
use "-Q" instead of "-q", so that site-init file is not read.

Same comment in the other places you invoke Emacs as a subordinate
process.

> +          (setopt ispell-library-directory "/tmp")

Please use temporary-file-directory, not a literal "/tmp" (which is
not portable), here and elsewhere.

> +    (let ((test-dict "nonexistent")
> +          (test-pdict "/tmp/lnonexistent.txt"))
                         ^^^^^^^^^^^^^^^^^^^^^^^
Likewise here: please use

   (expand-file-name "lnonexistent.txt" temporary-file-directory)

instead.  (There are several other places in the patch with the same
problem.)