ob-core: Add document and test for "graphics" format
[org-mode/org-tableheadings.git] / testing / lisp / test-org-pcomplete.el
blob56f7185e55803f6a2099fca9a77d5ed7d470c9c1
1 ;;; test-org-pcomplete.el --- test pcomplete integration
3 ;; Copyright (C) 2015-2016 Alexey Lebedeff
4 ;; Authors: Alexey Lebedeff
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Comments:
25 ;;; Code:
27 (ert-deftest test-org-pcomplete/prop ()
28 "Test property completion."
29 ;; Drawer where we are currently completing property name is
30 ;; malformed in any case, it'll become valid only after successful
31 ;; completion. We expect that this completion process will finish
32 ;; successfully, and there will be no interactive drawer repair
33 ;; attempts.
34 (should
35 (equal
36 "* a\n:PROPERTIES:\n:pname: \n:END:\n* b\n:PROPERTIES:\n:pname: pvalue\n:END:\n"
37 (org-test-with-temp-text "* a\n:PROPERTIES:\n:pna<point>\n:END:\n* b\n:PROPERTIES:\n:pname: pvalue\n:END:\n"
38 (cl-letf (((symbol-function 'y-or-n-p)
39 (lambda (_) (error "Should not be called"))))
40 (pcomplete))
41 (buffer-string)))))
43 (ert-deftest test-org-pcomplete/keyword ()
44 "Test keyword and block completion."
45 (should
46 (string-prefix-p
47 "#+startup: "
48 (org-test-with-temp-text "#+start<point>"
49 (pcomplete)
50 (buffer-string))
51 t))
52 (should
53 (string-prefix-p
54 "#+begin_center"
55 (org-test-with-temp-text "#+begin_ce<point>"
56 (pcomplete)
57 (buffer-string))
58 t)))
60 (provide 'test-org-pcomplete)
61 ;;; test-org-pcomplete.el ends here