branch: externals/hyperbole commit a81f544117dd2066483f20daa4d50f10f6c4d332 Author: Mats Lidell <mats.lid...@lidells.se> Commit: GitHub <nore...@github.com>
Add tests for hyrolo (#103) --- ChangeLog | 4 +++ test/hyrolo-tests.el | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/ChangeLog b/ChangeLog index cee61a4..1430864 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2021-06-19 Mats Lidell <ma...@gnu.org> +* test/hyrolo-tests.el (hyrolo-demo-search-work) + (hyrolo-demo-tab-jump-to-first-match, hyrolo-demo-toggle-visibility): + Add tests for hyrolo. + * hyrolo.el (hyrolo-file-list): Make variable customizable. * hsettings.el: Do not set user customizable properties diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el new file mode 100644 index 0000000..68ce444 --- /dev/null +++ b/test/hyrolo-tests.el @@ -0,0 +1,77 @@ +;;; hyrolo-tests.el --- unit tests for hyrolo.el -*- lexical-binding: t; -*- + +;; Author: Mats Lidell <ma...@gnu.org> +;; +;; Orig-Date: 19-Jun-21 at 22:42:00 +;; +;; Copyright (C) 2021 Free Software Foundation, Inc. +;; See the "HY-COPY" file for license information. +;; +;; This file is part of GNU Hyperbole. + +;;; Commentary: + +;; "../hyrolo.el" + +;;; Code: + +(require 'ert) +(require 'hact) +(require 'hyrolo) +(require 'hyrolo-demo) + +(load (expand-file-name "hy-test-helpers" + (file-name-directory (or load-file-name + default-directory)))) +(declare-function hy-test-helpers:consume-input-events "hy-test-helpers") +(declare-function hy-test-helpers:should-last-message "hy-test-helpers") + +(ert-deftest hyrolo-demo-search-work () + "Use demo example and search for work should match work." + (skip-unless (not noninteractive)) + (unwind-protect + (progn + (load "../hyrolo-demo") + (should (hact 'kbd-key "C-x 4r work RET")) + (hy-test-helpers:consume-input-events) + (should (string= (buffer-name) "*Hyperbole Rolo*")) + (should (looking-at "======")) + (forward-line 5) + (should (looking-at "\\*.*Work"))) + (hyrolo-demo-quit))) + +(ert-deftest hyrolo-demo-tab-jump-to-first-match () + "Tab shall jump to first match." + (skip-unless (not noninteractive)) + (unwind-protect + (progn + (load "../hyrolo-demo") + (should (hact 'kbd-key "C-x 4r work RET TAB")) + (hy-test-helpers:consume-input-events) + (should (string= (buffer-name) "*Hyperbole Rolo*")) + (should (looking-at "Work"))) + (hyrolo-demo-quit))) + +(ert-deftest hyrolo-demo-toggle-visibility () + "Keys h and a shall toggle visibility." + (skip-unless (not noninteractive)) + (unwind-protect + (progn + (load "../hyrolo-demo") + (should (hact 'kbd-key "C-x 4r work RET TAB")) + (hy-test-helpers:consume-input-events) + (should (string= (buffer-name) "*Hyperbole Rolo*")) + (should (looking-at "Work")) + + (should (hact 'kbd-key "h")) + (hy-test-helpers:consume-input-events) + (end-of-line) + (should (get-char-property (point) 'invisible)) + + (should (hact 'kbd-key "a")) + (hy-test-helpers:consume-input-events) + (should-not (get-char-property (point) 'invisible))) + (hyrolo-demo-quit))) + +(provide 'hyrolo-tests) +;;; hyrolo-tests.el ends here