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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Aug 2025 19:08:18 +0300

> From: Lockywolf <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Sat, 09 Aug 2025 23:31:29 +0800
> 
> Lockywolf <[email-masked]> writes:
> 
> > [[PGP Signed Part:Good signature from FBD6C1B20FEC6DAA Lockywolf (Provisional) <[email-masked]> (trust ultimate) created at 2025-08-09T23:29:34+0800 using EDDSA]]
> > Eli Zaretskii <[email-masked]> writes:
> >
> >> If there's no way of using some program that we are sure will be
> >> installed, please use skip-unless to skip the test when Bash is not
> >> available.
> >
> > Done.
> >
> >> Look, when I see "/foo/bar" file names in Emacs sources, it
> >> immediately draws my attention, because such file names cause
> >> portability problems.  So, unless using expand-file-name and/or
> >> temporary-file-directory here is somehow problematic and causes
> >> trouble, please do use them, so that this doesn't stand out, okay?
> >>
> >
> > I have tried to make the best of the discussion.
> > The test is there, and it should reliably fail on both GNU and Windows.

Thanks.  I've now run the tests on my system, and I have a couple of
minor comments.

First, the names of the test files don't follow our conventions.  They
should be ispell-aspell-tests.el and ispell-ispell-tests.el or just
ispell-tests.el.  IOW, the names must end in "-tests.el".

> +(ert-deftest ispell/ispell-init-process/works-nohome ()
> +  "Simple test to check that ispell-init-process works."
> +  :expected-result :failed
> +  (skip-unless (ispell-tests--some-backend-available-p))
> +  (letopt ((ispell-program-name (ispell-tests--some-backend)))
> +          (with-temp-buffer
> +            (ispell-init-process))))

This test unexpectedly passed on my system.  Can you explain why you
expected it to fail?

> +(ert-deftest ispell/ispell-accept-buffer-local-defs/simple ()
> +  "Check that `ispell-accept-buffer-local-defs' works for a
> +batch mode.
> +1. local words
> +2. dictionary and pdict
> +3. parser and extcharmode"
> +  (with-environment-variables (("HOME" temporary-file-directory))
> +    (with-temp-buffer
> +      (let ((test-dictname "english")
> +            (test-extcharmode "~latin3")
> +            (test-parser "~testparser")
> +            (test-localword1 "aaaaaaaaaaaaa")
> +            (test-localword2 "bbbbbbbbbbb")
> +            (test-pdict "test-pdict.pdict"))

This test is Ispell-specific, it will not work if the spell-checker
is, say, Hunspell.  For example, Hunspell's English dictionary is
"en_US", not "English".  So you should skip it if the backend is not
literally Ispell.