aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhil Sainty2019-10-22 01:01:28 +1300
committerPhil Sainty2019-11-15 00:39:12 +1300
commit90290745d74b18f8a824ea90fe6c6bf5110d716d (patch)
tree53054ada2e17f434c75411c2d6fc3e0ff7e2d8be /test
parent75875cac2100544f7c1192fc37ea23fbe9db12d7 (diff)
downloademacs-90290745d74b18f8a824ea90fe6c6bf5110d716d.tar.gz
emacs-90290745d74b18f8a824ea90fe6c6bf5110d716d.zip
; 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.el69
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 @@
1;;; spelling-tests.el --- Test suite for so-long.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; Author: Phil Sainty <psainty@orcon.net.nz>
6;; Keywords: convenience
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Code:
24
25(require 'ert)
26(require 'ispell)
27(require 'cl-lib)
28
29;; This test is tagged as :unstable on the basis that there may be
30;; inconsistencies between spell-checking facilities on different
31;; systems, which may cause the test to be unreliable in practice.
32;; As such the Emacs test Makefile will skip it by default, but you
33;; can run it manually with:
34;;
35;; make lisp/so-long-tests/spelling-tests SELECTOR=t
36
37;; Only define the test if spell-checking is possible.
38(when (and ispell-program-name
39 (executable-find ispell-program-name)
40 (condition-case ()
41 (progn (ispell-check-version) t)
42 (error nil))
43 (member "british" (ispell-valid-dictionary-list)))
44 (ert-deftest so-long-spelling ()
45 "Check the spelling in the source code."
46 :tags '(:unstable) ;; It works for me, but I'm not sure about others.
47 ;; There could be different "british" dictionaries yielding different
48 ;; results, for instance.
49 ;;
50 ;; The Emacs test Makefile's use of HOME=/nonexistent triggers an error
51 ;; when starting the inferior ispell process, so we set HOME to a valid
52 ;; (but empty) temporary directory for this test.
53 (let* ((tmpdir (make-temp-file "so-long." :dir ".ispell"))
54 (process-environment (cons (format "HOME=%s" tmpdir)
55 process-environment))
56 (find-spelling-mistake
57 (unwind-protect
58 (cl-letf (((symbol-function 'ispell-command-loop)
59 (lambda (_miss _guess word _start _end)
60 (message "Unrecognised word: %s." word)
61 (throw 'mistake t))))
62 (catch 'mistake
63 (find-library "so-long")
64 (ispell-buffer)
65 nil))
66 (delete-directory tmpdir))))
67 (should (not find-spelling-mistake)))))
68
69;;; spelling-tests.el ends here