test-org-archive.el 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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** DONE One\n** TODO Two"
  23. (forward-line)
  24. (org-archive-subtree)
  25. (forward-line -1)
  26. (org-element-property :title (org-element-at-point)))))
  27. ;; Test org-archive-subtree with one child.
  28. (should
  29. (equal
  30. "Top [100%]"
  31. (org-test-with-temp-text-in-file "* Top [%]\n** TODO Two"
  32. (forward-line)
  33. (org-archive-subtree)
  34. (forward-line -1)
  35. (org-element-property :title (org-element-at-point)))))
  36. ;; Test org-archive-to-archive-sibling with two children.
  37. (should
  38. (equal
  39. "Top [100%]"
  40. (org-test-with-temp-text "* Top [%]\n<point>** TODO One\n** DONE Two"
  41. (org-archive-to-archive-sibling)
  42. (forward-line -1)
  43. (org-element-property :title (org-element-at-point)))))
  44. ;; Test org-archive-to-archive-sibling with two children.
  45. (should
  46. (equal
  47. "Top [0%]"
  48. (org-test-with-temp-text "* Top [%]\n<point>** DONE Two"
  49. (org-archive-to-archive-sibling)
  50. (forward-line -1)
  51. (org-element-property :title (org-element-at-point))))))
  52. (provide 'test-org-archive)
  53. ;;; test-org-archive.el ends here