test-org-pcomplete.el 1.9 KB

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