diff --git a/ChangeLog b/ChangeLog index e43bec5b..9ea02b24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,20 @@ * hmouse-tag.el (smart-lisp-find-tag): Fix issue where 'hkey-value' was used as tag when it was not a string, causing failures on known function lookups. +2023-12-29 Mats Lidell + +* test/demo-tests.el (fast-demo-markdown-anchor-with-spaces) + (fast-demo-elisp-or-env-vars, fast-demo-elisp-library-in-load-path) + (fast-demo-info-manual-references, fast-demo-grep) + (fast-demo-python-trace-back, fast-demo-man-k) + (fast-demo-action-button-shell, fast-demo-action-button-fill-column) + (fast-demo-display-demo-using-action-buttons) + (fast-demo-display-kotl-starting-from-cell) + (fast-demo-outline-section-anchor-and-relative-line-number) + (fast-demo-markdown-anchor-with-spaces) + (fast-demo-elisp-library-in-load-path) + (fast-demo-elisp-or-env-vars): Add remaining test cases for fast-demo. + 2023-12-28 Bob Weiner * kotl/kotl-mode.el (kotl-mode:pre-self-insert-command): Add these kotl-mode diff --git a/FAST-DEMO b/FAST-DEMO index becac6b5..878b9081 100644 --- a/FAST-DEMO +++ b/FAST-DEMO @@ -135,11 +135,11 @@ ** Pathname Implicit Buttons - "HY-NEWS#ORG MODE:2:6" - outline section anchor & relative line number + "HY-NEWS#ORG MODE:3:6" - outline section anchor & relative line number Display the file, "HY-NEWS", go to the star-outline section 'ORG - MODE', move 2 lines into that section and then move 6 characters - forward. "HY-NEWS#ORG MODE:L2:C6" with the line and column numbers + MODE', move 3 lines into that section and then move 6 characters + forward. "HY-NEWS#ORG MODE:L3:C6" with the line and column numbers labeled works as well. Existing files and pathnames without spaces are also recognized without diff --git a/test/demo-tests.el b/test/demo-tests.el index be116cd8..0b1c328d 100644 --- a/test/demo-tests.el +++ b/test/demo-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 30-Jan-21 at 12:00:00 -;; Last-Mod: 25-Dec-23 at 23:30:20 by Mats Lidell +;; Last-Mod: 29-Dec-23 at 00:19:28 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -240,13 +240,6 @@ (action-key) (hy-test-helpers:should-last-message "Result = nil; Boolean value = False"))) -(ert-deftest demo-implicit-button-action-button-variable-display-test () - (with-temp-buffer - (insert "") - (goto-char 2) - (action-key) - (hy-test-helpers:should-last-message (format "fill-column = %d" (current-fill-column))))) - (ert-deftest demo-implicit-button-hash-link-test () (unwind-protect (with-temp-buffer @@ -425,6 +418,65 @@ (hy-test-helpers:should-last-message "Factorial of 5 = 120")) (hy-test-helpers:kill-buffer "DEMO"))) +;;; Fast demo +;; Implicit Buttons +(ert-deftest fast-demo-outline-section-anchor-and-relative-line-number () + "Verify star outline section links with line and column works." + (dolist (link '("\"HY-NEWS#ORG MODE:3:6\"" "\"HY-NEWS#ORG MODE:L3:C6\"")) + (unwind-protect + (let ((default-directory hyperb:dir)) + (with-temp-buffer + (insert link) + (goto-char 3) + (action-key) + (should (string= (buffer-name (current-buffer)) "HY-NEWS")) + (should (looking-at-p "M-RET: Reworked")))) + (hy-test-helpers:kill-buffer "HY-NEWS")))) + +(ert-deftest fast-demo-markdown-anchor-with-spaces () + "Verify anchor with spaces works." + (unwind-protect + (let ((default-directory hyperb:dir)) + (with-temp-buffer + (insert "\"README.md#Hyperbole Components\"") + (goto-char 3) + (action-key) + (should (string= (buffer-name (current-buffer)) "README.md")) + (should (looking-at-p "## Hyperbole Components")))) + (hy-test-helpers:kill-buffer "README.md"))) + +(ert-deftest fast-demo-elisp-or-env-vars () + "Verify Elisp or env variables work in paths." + (unwind-protect + (with-temp-buffer + (insert "\"${hyperb:dir}/HY-NEWS\"") + (goto-char 3) + (action-key) + (should (string= (buffer-name (current-buffer)) "HY-NEWS"))) + (hy-test-helpers:kill-buffer "HY-NEWS"))) + +(ert-deftest fast-demo-elisp-library-in-load-path () + "Verify ibut to Elisp library works." + (let (bufname) + (unwind-protect + (with-temp-buffer + (insert "\"subr.el\"") + (goto-char 3) + (action-key) + (setq bufname (buffer-name (current-buffer))) + (should (string-prefix-p "subr.el" bufname)))) + (hy-test-helpers:kill-buffer bufname))) + +(ert-deftest fast-demo-info-manual-references () + "Verify info manual references works." + (unwind-protect + (with-temp-buffer + (insert "\"(hyperbole)action-key-modeline-function\"") + (goto-char 3) + (action-key) + (should (string= Info-current-node "Smart Mouse Key Modeline Clicks"))) + (hy-test-helpers:kill-buffer "*info*"))) + ;; Fast demo key series (ert-deftest fast-demo-key-series-help-buffer () "Action key on C-hA brings up help buffer for action key." @@ -681,5 +733,101 @@ enough files with matching mode loaded." ;; no-byte-compile: t ;; End: + +;; Fast Demo Grep Messages, Stack Trace, Man Page Apropos +(ert-deftest fast-demo-grep () + "Verify ibuts from grep searches works." + (unwind-protect + (with-temp-buffer + (insert "hactypes.el:454: (mapcar #'list (gbut:label-list))\nhbut.el:605: (mapcar #'list (gbut:label-list))\n") + (goto-char 3) + (action-key) + (should (string= (buffer-name (current-buffer)) "hactypes.el")) + (should (= (line-number-at-pos) 454))) + (hy-test-helpers:kill-buffer "hactypes.el"))) + +(ert-deftest fast-demo-python-trace-back () + "Verify ibuts from python traceback works." + (unwind-protect + (let ((default-directory hyperb:dir)) + (with-temp-buffer + (insert "Traceback (most recent call last):\n File \"topwin.py\", line 18, in \n import Quartz\n") + (goto-char (point-min)) + (forward-line 1) + (goto-char (+ (point) 3)) + (action-key) + (should (string= (buffer-name (current-buffer)) "topwin.py")) + (should (= (line-number-at-pos) 18)))) + (hy-test-helpers:kill-buffer "topwin.py"))) + +(ert-deftest fast-demo-man-k () + "Verify ibut in man -k output displays the associated man page." + (with-temp-buffer + (insert "aspell(1) - interactive spell checker") + (goto-char 3) + (with-mock + (mock (man "aspell(1)") => t) + (action-key)))) + +;; Fast Demo Action Buttons +(ert-deftest fast-demo-action-button-shell () + "Verify a shell is created when action button for shell is invoked." + (unwind-protect + (with-temp-buffer + (insert "") + (goto-char 3) + (action-key) + (should (string= (buffer-name (current-buffer)) "*shell*"))) + (let (kill-buffer-hook kill-buffer-query-functions) + (hy-test-helpers:kill-buffer "*shell*")))) + +(ert-deftest fast-demo-action-button-fill-column () + "Verify the value of `fill-column' is displayed in the minibuffer." + (with-temp-buffer + (insert "") + (goto-char 2) + (action-key) + (hy-test-helpers:should-last-message (format "fill-column = %d" (current-fill-column))))) + +(ert-deftest fast-demo-display-demo-using-action-buttons () + "Verify the three ways show in the demo works." + (unwind-protect + (with-temp-buffer + (insert "") + (goto-char 5) + (let ((enable-local-variables nil)) + (action-key)) + (should (string= "DEMO" (buffer-name)))) + (hy-test-helpers:kill-buffer "DEMO")) + (unwind-protect + (with-temp-buffer + (insert "") + (goto-char 5) + (let ((enable-local-variables nil)) + (action-key)) + (should (string= "DEMO" (buffer-name)))) + (hy-test-helpers:kill-buffer "DEMO")) + (unwind-protect + (with-temp-buffer + (insert "\"${hyperb:dir}/DEMO\"") ; Need double quotes - Error!? + (goto-char 5) + (let ((enable-local-variables nil)) + (action-key)) + (should (string= "DEMO" (buffer-name)))) + (hy-test-helpers:kill-buffer "DEMO"))) + +(ert-deftest fast-demo-display-kotl-starting-from-cell () + "Verify a kotl file can be displayed from cell ref." + (unwind-protect + (let ((default-directory hyperb:dir)) + (with-temp-buffer + (insert "") + (goto-char 5) + (action-key) + (should (string= "EXAMPLE.kotl" (buffer-name))) + ;; FIXME: Add verification of lines per cell + (should (looking-at-p "Cell Transposition:")))) + (hy-test-helpers:kill-buffer "EXAMPLE.kotl"))) + (provide 'demo-tests) ;;; demo-tests.el ends here