diff options
author | Ulrich Müller <ulm@gentoo.org> | 2024-08-26 18:24:08 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2024-08-28 00:02:55 +0200 |
commit | 83b737d1d9b40a2c51a8511be3da6422554b566d (patch) | |
tree | 064470f47f79b07e39afc75066abbd15a1d7052d /test/glep-mode-tests.el | |
parent | Return a useful exit status for XEmacs tests (diff) | |
download | ebuild-mode-83b737d1d9b40a2c51a8511be3da6422554b566d.tar.gz ebuild-mode-83b737d1d9b40a2c51a8511be3da6422554b566d.tar.bz2 ebuild-mode-83b737d1d9b40a2c51a8511be3da6422554b566d.zip |
More tests
* test/ebuild-mode-tests.el (ebuild-mode-test-input): New variable
and function.
(ebuild-mode-test-skeleton, ebuild-mode-test-keybindings):
New tests.
* test/glep-mode-tests.el (glep-mode-test-input): New variable and
function.
(glep-mode-test-skeleton, glep-mode-test-keybindings): New tests.
* test/gentoo-newsitem-mode-tests.el:
* test/devbook-mode-tests.el: New files.
* Makefile (TESTS): Add them.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'test/glep-mode-tests.el')
-rw-r--r-- | test/glep-mode-tests.el | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/glep-mode-tests.el b/test/glep-mode-tests.el index 9400752..7318293 100644 --- a/test/glep-mode-tests.el +++ b/test/glep-mode-tests.el @@ -31,6 +31,11 @@ (funcall orig-fun fmt-string (or time fixed-time) zone)))) ,@body)) +(defvar glep-mode-test-input nil) + +(defun glep-mode-test-input (&rest _args) + (concat (pop glep-mode-test-input))) + (ert-deftest glep-mode-test-font-lock () (with-temp-buffer (glep-mode) @@ -79,6 +84,42 @@ "---\n" "Last-Modified: 2023-02-22\n")))))) +(ert-deftest glep-mode-test-skeleton () + (with-temp-buffer + (cl-letf (((symbol-function 'read-from-minibuffer) + #'glep-mode-test-input) + ((symbol-function 'read-string) + #'glep-mode-test-input) + (buffer-file-name + "/home/larry/devmanual/quickstart/text.xml")) + (setq glep-mode-test-input + '("9999" ; GLEP + "Skeleton test" ; Title + "Larry the Cow" ; Author + "Informational" ; Type + "Draft" ; Status + "1" ; Version + "" ; Requires + "")) ; Replaces + (glep-mode-test-run-with-fixed-time + (glep-mode-insert-skeleton))) + (goto-char (point-min)) + (search-forward "---\n" nil nil 2) + (should (string-equal + (buffer-substring (point-min) (point)) + (concat "---\n" + "GLEP: 9999\n" + "Title: Skeleton test\n" + "Author: Larry the Cow\n" + "Type: Informational\n" + "Status: Draft\n" + "Version: 1\n" + "Created: 2024-08-10\n" + "Last-Modified: 2024-08-10\n" + "Post-History: \n" + "Content-Type: text/x-rst\n" + "---\n"))))) + (ert-deftest glep-mode-test-in-preamble-p () (with-temp-buffer (let ((preamble "---\nGLEP: 2\n---\n")) @@ -91,6 +132,14 @@ (forward-line 3) (should-not (glep-mode-in-preamble-p (point))))) +(ert-deftest glep-mode-test-keybindings () + (should (equal (lookup-key glep-mode-map "\C-c\C-n") + 'glep-mode-insert-skeleton)) + (with-temp-buffer + (glep-mode) + (should (equal (local-key-binding "\C-c\C-n") + 'glep-mode-insert-skeleton)))) + (provide 'glep-mode-tests) ;; Local Variables: |