test-org-archive.el 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ;;; test-org-archive.el --- Test for Org Archive -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2017 Jay Kamat
  3. ;; Author: Jay Kamat <jaygkamat@gmail.com>
  4. ;; This program is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public License
  13. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. ;;; Code:
  15. (ert-deftest test-org-element/archive-update-status-cookie ()
  16. "Test archiving properly updating status cookies."
  17. ;; Test org-archive-subtree with two children.
  18. (should
  19. (equal
  20. "Top [0%]"
  21. (org-test-with-temp-text-in-file
  22. "* Top [%]\n<point>** DONE One\n** TODO Two"
  23. (org-archive-subtree)
  24. (forward-line -1)
  25. (org-element-property :title (org-element-at-point)))))
  26. ;; Test org-archive-subtree with one child.
  27. (should
  28. (equal
  29. "Top [100%]"
  30. (org-test-with-temp-text-in-file "* Top [%]\n<point>** TODO Two"
  31. (org-archive-subtree)
  32. (forward-line -1)
  33. (org-element-property :title (org-element-at-point)))))
  34. ;; Test org-archive-to-archive-sibling with two children.
  35. (should
  36. (equal
  37. "Top [100%]"
  38. (org-test-with-temp-text "* Top [%]\n<point>** TODO One\n** DONE Two"
  39. (org-archive-to-archive-sibling)
  40. (forward-line -1)
  41. (org-element-property :title (org-element-at-point)))))
  42. ;; Test org-archive-to-archive-sibling with two children.
  43. (should
  44. (equal
  45. "Top [0%]"
  46. (org-test-with-temp-text "* Top [%]\n<point>** DONE Two"
  47. (org-archive-to-archive-sibling)
  48. (forward-line -1)
  49. (org-element-property :title (org-element-at-point))))))
  50. (provide 'test-org-archive)
  51. ;;; test-org-archive.el ends here