diff options
author | Phil Sainty <psainty@orcon.net.nz> | 2019-10-22 01:01:28 +1300 |
---|---|---|
committer | Phil Sainty <psainty@orcon.net.nz> | 2019-11-15 00:39:12 +1300 |
commit | 90290745d74b18f8a824ea90fe6c6bf5110d716d (patch) | |
tree | 53054ada2e17f434c75411c2d6fc3e0ff7e2d8be /test | |
parent | 75875cac2100544f7c1192fc37ea23fbe9db12d7 (diff) | |
download | emacs-90290745d74b18f8a824ea90fe6c6bf5110d716d.tar.gz |
; Documentation and spelling
* lisp/so-long.el: Documentation fixes. For the purposes of
consistency, this reverts some of the changes made in commit
41ba8231ef072571e1a6feabc15d113e5cf57556, including one which
had introduced inconsistent spelling.
ispell configuration and LocalWords have been added such that
`ispell-buffer' should find no misspellings for this library.
* test/lisp/so-long-tests/spelling-tests.el (so-long-spelling):
New test to check the spelling using `ispell-buffer'.
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/so-long-tests/spelling-tests.el | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/lisp/so-long-tests/spelling-tests.el b/test/lisp/so-long-tests/spelling-tests.el new file mode 100644 index 00000000000..d5bae1ef0ce --- /dev/null +++ b/test/lisp/so-long-tests/spelling-tests.el @@ -0,0 +1,69 @@ +;;; spelling-tests.el --- Test suite for so-long.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; Author: Phil Sainty <psainty@orcon.net.nz> +;; Keywords: convenience + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'ispell) +(require 'cl-lib) + +;; This test is tagged as :unstable on the basis that there may be +;; inconsistencies between spell-checking facilities on different +;; systems, which may cause the test to be unreliable in practice. +;; As such the Emacs test Makefile will skip it by default, but you +;; can run it manually with: +;; +;; make lisp/so-long-tests/spelling-tests SELECTOR=t + +;; Only define the test if spell-checking is possible. +(when (and ispell-program-name + (executable-find ispell-program-name) + (condition-case () + (progn (ispell-check-version) t) + (error nil)) + (member "british" (ispell-valid-dictionary-list))) + (ert-deftest so-long-spelling () + "Check the spelling in the source code." + :tags '(:unstable) ;; It works for me, but I'm not sure about others. + ;; There could be different "british" dictionaries yielding different + ;; results, for instance. + ;; + ;; The Emacs test Makefile's use of HOME=/nonexistent triggers an error + ;; when starting the inferior ispell process, so we set HOME to a valid + ;; (but empty) temporary directory for this test. + (let* ((tmpdir (make-temp-file "so-long." :dir ".ispell")) + (process-environment (cons (format "HOME=%s" tmpdir) + process-environment)) + (find-spelling-mistake + (unwind-protect + (cl-letf (((symbol-function 'ispell-command-loop) + (lambda (_miss _guess word _start _end) + (message "Unrecognised word: %s." word) + (throw 'mistake t)))) + (catch 'mistake + (find-library "so-long") + (ispell-buffer) + nil)) + (delete-directory tmpdir)))) + (should (not find-spelling-mistake))))) + +;;; spelling-tests.el ends here |