Add: Tests, Makefile, Cask
This commit is contained in:
parent
7fed9f43bf
commit
3d4ad1ab36
4 changed files with 92 additions and 0 deletions
10
tests/data.org
Normal file
10
tests/data.org
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
* Data
|
||||
|
||||
** Clocked
|
||||
|
||||
*** Clocked from 2018-12-01 00:00 to 2018-12-10 23:59
|
||||
:LOGBOOK:
|
||||
CLOCK: [2018-12-01 Sat 00:00]--[2018-12-10 Mon 23:59] => 239:59
|
||||
:END:
|
||||
70
tests/test-org-ql.el
Normal file
70
tests/test-org-ql.el
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
;;; org-ql.el --- Tests for org-ql -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2019 Adam Porter
|
||||
|
||||
;; Author: Adam Porter <adam@alphapapa.net>
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;;; Requirements
|
||||
|
||||
(require 'org-ql)
|
||||
(require 'org-ql-agenda)
|
||||
|
||||
;;;; Variables
|
||||
|
||||
|
||||
|
||||
;;;; Functions
|
||||
|
||||
;;;; Tests
|
||||
|
||||
(describe "org-ql"
|
||||
(before-all
|
||||
(setq test-buffer (find-file-noselect (concat default-directory "tests/data.org"))))
|
||||
|
||||
(describe "Can select entries clocked..."
|
||||
(it "...at any time"
|
||||
(expect (org-ql test-buffer
|
||||
(clocked)
|
||||
:action (org-get-heading t t))
|
||||
:to-equal '("Clocked from 2018-12-01 00:00 to 2018-12-10 23:59")))
|
||||
(it "...after (:from) a timestamp"
|
||||
(expect (org-ql test-buffer
|
||||
(clocked :from "2018-11-10")
|
||||
:action (org-get-heading t t))
|
||||
:to-equal '("Clocked from 2018-12-01 00:00 to 2018-12-10 23:59")))
|
||||
(it "...up to (:to) a timestamp"
|
||||
(expect (org-ql test-buffer
|
||||
(clocked :to "2018-12-30")
|
||||
:action (org-get-heading t t))
|
||||
:to-equal '("Clocked from 2018-12-01 00:00 to 2018-12-10 23:59")))
|
||||
(it "...on a date"
|
||||
(expect (org-ql test-buffer
|
||||
(clocked :on "2018-12-02")
|
||||
:action (org-get-heading t t))
|
||||
:to-equal '("Clocked from 2018-12-01 00:00 to 2018-12-10 23:59")))
|
||||
(it "...within a date range"
|
||||
(expect (org-ql test-buffer
|
||||
(clocked :from "2018-12-03" :to "2018-12-11")
|
||||
:action (org-get-heading t t))
|
||||
:to-equal '("Clocked from 2018-12-01 00:00 to 2018-12-10 23:59")))))
|
||||
|
||||
;;; org-ql.el ends here
|
||||
Loading…
Add table
Add a link
Reference in a new issue