1 ;;; test-org-tempo.el --- Tests for test-org-tempo.el -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2017 Rasmus Pank Roulund
5 ;; Author: Rasmus Pank Roulund <emacs at pank dot eu>
7 ;; This file is not part of GNU Emacs.
9 ;; This program is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
26 (unless (featurep 'org-temp
)
27 (signal 'missing-test-dependency
"org-tempo"))
29 (ert-deftest test-org-tempo
/completion
()
30 "Test that blocks and keywords are expanded correctly by org-tempo."
31 ;; Tempo completion should recognize snippet keywords and expand with tab
33 (equal (org-test-with-temp-text "<L<point>"
38 ;; Tempo completion should recognize snippet Blocks
40 (equal (org-test-with-temp-text "<l<point>"
42 (call-interactively 'org-cycle
)
44 "#+begin_export latex \n\n#+end_export"))
45 ;; Tab should work for expansion.
47 (equal (org-test-with-temp-text "<L<point>"
51 (org-test-with-temp-text "<L<point>"
55 ;; Tempo should not expand unknown snippets
56 (equal (org-test-with-temp-text "<k"
58 (call-interactively 'org-cycle
)
62 (ert-deftest test-org-tempo
/add-new-templates
()
63 "Test that new structures and keywords are added correctly."
64 ;; Check that deleted keys are not kept
66 (let ((org-structure-template-alist '((?n .
"new_block"))))
67 (org-tempo-add-templates)
68 (assoc "<n" org-tempo-tags
)))
70 (let ((org-tempo-keywords-alist '((?N .
"new_keyword"))))
71 (org-tempo-add-templates)
72 (assoc "<N" org-tempo-tags
))))
74 (provide 'test-org-tempo
)
75 ;;; test-org-tempo.el end here