Tests: Add/change convenience commands

This commit is contained in:
Adam Porter 2019-07-16 12:34:20 -05:00
parent 7dcdc21ea1
commit 25ce89ca2c

View file

@ -34,13 +34,26 @@
(defun org-ql-test-insert-result () (defun org-ql-test-insert-result ()
"FIXME: docstring" "FIXME: docstring"
(interactive) (interactive)
(let* ((value (eval (elisp--preceding-sexp))) (if-let* ((sexp (elisp--preceding-sexp))
(prefix (if (and value (listp value)) (correct-sexp-p (eq (car sexp) 'org-ql))
"'" (value (eval sexp))
""))) (prefix (if (and value (listp value))
(insert " :to-equal " "'"
prefix "")))
(format "%S" value)))) (insert " :to-equal "
prefix
(format "%S" value))
(user-error "Point must be after an `org-ql' form")))
(defun org-ql-test-show-result ()
"Show `org-ql-agenda' for `org-ql' form."
(interactive)
(if-let* ((sexp (elisp--preceding-sexp))
(correct-sexp-p (eq (car sexp) 'org-ql)))
(progn
(setf (car sexp) 'org-ql-agenda)
(eval sexp))
(user-error "Point must be after an `org-ql' form")))
;;;; Tests ;;;; Tests