diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 69a816b..315853a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,5 +22,7 @@ jobs: with: version: ${{ matrix.emacs_version }} - uses: actions/checkout@v1 - - name: Run a one-line script - run: echo Hello, world! + - name: Install taskwarrior package + run: sudo apt-get install -y taskwarrior + - name: Run ERT test suite + run: make test diff --git a/.gitignore b/.gitignore index c2a8832..a59aa95 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.task \ No newline at end of file +.task +dash.el +transient.el \ No newline at end of file diff --git a/Makefile b/Makefile index 98c3334..457d278 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,13 @@ -.PHONY: test-data +.PHONY: test-data test-data: ## Generate some example tasks for n in $$(seq 10); do task add "Example task $${n}"; done + +.PHONY: test +test: fetch-deps ## Run ERT test suite + emacs -batch -l dash.el -l transient.el -l taskwarrior.el -l taskwarrior-test.el -f ert-run-tests-batch-and-exit + +.PHONY: fetch-deps +fetch-deps: ## Fetch required dependencies + curl -fsSkL --retry 9 --retry-delay 9 -O "https://raw.githubusercontent.com/magit/transient/master/lisp/transient.el" + curl -fsSkL --retry 9 --retry-delay 9 -O "https://raw.githubusercontent.com/magnars/dash.el/master/dash.el" diff --git a/taskwarrior-test.el b/taskwarrior-test.el index 3c0b3d8..d03ff30 100644 --- a/taskwarrior-test.el +++ b/taskwarrior-test.el @@ -2,18 +2,16 @@ ;;; Commentary: -;; Run standalone with this, -;; emacs -batch -L . -l taskwarrior-test.el -f ert-run-tests-batch +;; Run through make target `m̀ake test` ;;; 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)"))) + (should (string= (alist-get 'description task) "Write test suite for taskwarrior.el (using ERT)")))) diff --git a/taskwarrior.el b/taskwarrior.el index 7d0629e..6cce5f0 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -8,6 +8,8 @@ ;; TODO: Restore position after taskwarrior-update-buffer is called (require 'json) +(require 'dash) +(require 'transient) (defgroup taskwarrior nil "An emacs frontend to taskwarrior.")