2019-11-04 12:46:43 +01:00
|
|
|
;;; taskwarrior-test.el --- Taskwarrior test suite -*- lexical-binding: t; -*-
|
2019-10-22 18:52:52 +02:00
|
|
|
|
2019-11-04 12:46:43 +01:00
|
|
|
;; Copyright (C) 2019-2020 Patrick Winter
|
|
|
|
;;
|
|
|
|
;; License: GPLv3
|
2019-10-22 18:52:52 +02:00
|
|
|
|
2019-11-04 12:46:43 +01:00
|
|
|
;;; Commentary:
|
2019-10-22 18:52:52 +02:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2019-11-04 12:46:43 +01:00
|
|
|
(require 'taskwarrior)
|
2019-10-22 18:52:52 +02:00
|
|
|
|
2019-11-04 12:46:43 +01:00
|
|
|
(ert-deftest taskwarrior-add-task ()
|
2019-10-22 18:52:52 +02:00
|
|
|
"Ensure that special characters such as quotes and parens are properly escaped when adding new tasks"
|
|
|
|
(let* ((task-id (taskwarrior--add "project:ert +emacs \"Write test suite for taskwarrior.el (using ERT)\""))
|
|
|
|
(task (taskwarrior-export-task task-id)))
|
|
|
|
(should (string= (alist-get 'project task) "ert"))
|
|
|
|
(should (string= (aref (alist-get 'tags task) 0) "emacs"))
|
2019-10-23 11:38:57 +02:00
|
|
|
(should (string= (alist-get 'description task) "Write test suite for taskwarrior.el (using ERT)"))))
|
2019-11-04 12:46:43 +01:00
|
|
|
|
2019-11-04 15:36:46 +01:00
|
|
|
(ert-deftest taskwarrior-parse-task-id ()
|
|
|
|
(should (string= (taskwarrior--parse-created-task-id "Created task 9.") "9"))
|
|
|
|
(should (string= (taskwarrior--parse-created-task-id "Created task 1000.") "1000"))
|
|
|
|
(should (string= (taskwarrior--parse-created-task-id "Some invalid input") nil)))
|
|
|
|
|
2019-11-07 19:01:18 +01:00
|
|
|
(ert-deftest taskwarrior--parse-date ()
|
2019-11-07 19:24:21 +01:00
|
|
|
(should (string= (taskwarrior--parse-date "20191108T225959Z") "2019-11-08"))
|
|
|
|
(should (string= (taskwarrior--parse-date "20191108T225959Z" :date) "2019-11-08"))
|
|
|
|
(should (string= (taskwarrior--parse-date "20191108T225959Z" :datetime) "2019-11-08 22:59:59")))
|
2019-11-07 19:01:18 +01:00
|
|
|
|
2019-11-04 15:36:46 +01:00
|
|
|
|
2019-11-04 12:46:43 +01:00
|
|
|
(provide 'taskwarrior-test)
|
|
|
|
;;; taskwarrior-test.el ends here
|