Add make target to start test runner

This commit is contained in:
Patrick Winter 2019-10-23 11:38:57 +02:00
parent 703994420c
commit 1afcb6f37a
5 changed files with 21 additions and 8 deletions

View file

@ -22,5 +22,7 @@ jobs:
with: with:
version: ${{ matrix.emacs_version }} version: ${{ matrix.emacs_version }}
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Run a one-line script - name: Install taskwarrior package
run: echo Hello, world! run: sudo apt-get install -y taskwarrior
- name: Run ERT test suite
run: make test

2
.gitignore vendored
View file

@ -1 +1,3 @@
.task .task
dash.el
transient.el

View file

@ -1,4 +1,13 @@
.PHONY: test-data
.PHONY: test-data
test-data: ## Generate some example tasks test-data: ## Generate some example tasks
for n in $$(seq 10); do task add "Example task $${n}"; done 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"

View file

@ -2,18 +2,16 @@
;;; Commentary: ;;; Commentary:
;; Run standalone with this, ;; Run through make target `m̀ake test`
;; emacs -batch -L . -l taskwarrior-test.el -f ert-run-tests-batch
;;; Code: ;;; Code:
(require 'ert) (require 'ert)
(ert-deftest taskwarrior-add-task-test () (ert-deftest taskwarrior-add-task-test ()
"Ensure that special characters such as quotes and parens are properly escaped when adding new tasks" "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)\"")) (let* ((task-id (taskwarrior--add "project:ert +emacs \"Write test suite for taskwarrior.el (using ERT)\""))
(task (taskwarrior-export-task task-id))) (task (taskwarrior-export-task task-id)))
(should (string= (alist-get 'project task) "ert")) (should (string= (alist-get 'project task) "ert"))
(should (string= (aref (alist-get 'tags task) 0) "emacs")) (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)"))))

View file

@ -8,6 +8,8 @@
;; TODO: Restore position after taskwarrior-update-buffer is called ;; TODO: Restore position after taskwarrior-update-buffer is called
(require 'json) (require 'json)
(require 'dash)
(require 'transient)
(defgroup taskwarrior nil "An emacs frontend to taskwarrior.") (defgroup taskwarrior nil "An emacs frontend to taskwarrior.")