From 703994420c3328f96bb50431649457e9f091c04d Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Tue, 22 Oct 2019 18:52:52 +0200 Subject: [PATCH] Add test for taskwarrior--add --- taskwarrior-test.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 taskwarrior-test.el diff --git a/taskwarrior-test.el b/taskwarrior-test.el new file mode 100644 index 0000000..3c0b3d8 --- /dev/null +++ b/taskwarrior-test.el @@ -0,0 +1,19 @@ +;;; taskwarrior-test.el --- taskwarrior unit tests + +;;; Commentary: + +;; Run standalone with this, +;; emacs -batch -L . -l taskwarrior-test.el -f ert-run-tests-batch + +;;; Code: + +(require 'ert) + + +(ert-deftest taskwarrior-add-task-test () + "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")) + (should (string= (alist-get 'description task) "Write test suite for taskwarrior.el (using ERT)")))