[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-edna 00ef89a 11/72: Added tests for org-bat-parse-for
From: |
Ian Dunn |
Subject: |
[elpa] scratch/org-edna 00ef89a 11/72: Added tests for org-bat-parse-form |
Date: |
Sun, 21 May 2017 21:11:19 -0400 (EDT) |
branch: scratch/org-edna
commit 00ef89a443c6cd17e102207289169cbd0f3faf71
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
Added tests for org-bat-parse-form
* org-bat-tests.el (org-bat-parse-form-no-arguments):
(org-bat-parse-form-no-arguments-modifier):
(org-bat-parse-form-single-argument):
(org-bat-parse-form-string-argument): New tests.
---
org-bat-tests.el | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/org-bat-tests.el b/org-bat-tests.el
new file mode 100644
index 0000000..4a1e32f
--- /dev/null
+++ b/org-bat-tests.el
@@ -0,0 +1,64 @@
+;;; org-bat-tests.el --- Tests for org-bat
+
+;; Author: Ian Dunn
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'org-bat)
+(require 'ert)
+
+(ert-deftest org-bat-parse-form-no-arguments ()
+ (let* ((input-string "test-string")
+ (parsed (org-bat-parse-form input-string)))
+ (should parsed)
+ (should (= (length parsed) 4))
+ (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
+ (should (eq token 'test-string))
+ (should (not args))
+ (should (not modifier))
+ (should (= pos 11)))))
+
+(ert-deftest org-bat-parse-form-no-arguments-modifier ()
+ (let* ((input-string "!test-string")
+ (parsed (org-bat-parse-form input-string)))
+ (should parsed)
+ (should (= (length parsed) 4))
+ (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
+ (should (eq token 'test-string))
+ (should (not args))
+ (should (eq modifier '!))
+ (should (= pos 12)))))
+
+(ert-deftest org-bat-parse-form-single-argument ()
+ (let* ((input-string "test-string(abc)")
+ (parsed (org-bat-parse-form input-string)))
+ (should parsed)
+ (should (= (length parsed) 4))
+ (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
+ (should (eq token 'test-string))
+ (should (= (length args) 1))
+ (should (stringp (nth 0 args)))
+ (should (string-equal (nth 0 args) "abc"))
+ (should (not modifier))
+ (should (= pos (length input-string))))))
+
+(ert-deftest org-bat-parse-form-string-argument ()
+ (let* ((input-string "test-string(abc,\"def (ghi)\")")
+ (parsed (org-bat-parse-form input-string)))
+ (should parsed)
+ (should (= (length parsed) 4))
+ (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
+ (should (eq token 'test-string))
+ (should (= (length args) 2))
+ (should (stringp (nth 0 args)))
+ (should (string-equal (nth 0 args) "abc"))
+ (should (stringp (nth 1 args)))
+ (should (string-equal (nth 1 args) "def (ghi)"))
+ (should (not modifier))
+ (should (= pos (length input-string))))))
+
+(provide 'org-bat-tests)
+
+;;; org-bat-tests.el ends here
- [elpa] branch scratch/org-edna created (now 901a84a), Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 352d95c 06/72: Added has-property condition, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 69cc5d4 07/72: Added package requirements, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 0273bf1 02/72: Make all finders return lists of markers, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 03a6a95 03/72: Added Makefile., Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 5e69f84 04/72: Added .bzrignore., Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 6ec67b8 10/72: Improved org-bat-parse-form to handle new argument types, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 8b58c07 14/72: Clarified use of case-fold-search in `org-bat--handle-planning', Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 00ef89a 11/72: Added tests for org-bat-parse-form,
Ian Dunn <=
- [elpa] scratch/org-edna 8aeb66c 08/72: Added more custom IDs to documentation, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 89baba4 13/72: Added chain action, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna e2db4dc 19/72: Remove duplicate targets, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 68b01b8 16/72: Fixed bug in Makefile, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna dc320fe 17/72: Use existing org-xor instead of new function, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 0977b83 20/72: Don't assume arguments will be symbols or strings, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 8a8cfd6 12/72: Cleaned up condition handling, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna b40f7f0 05/72: Added initial documentation, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 4a54e3b 09/72: Fixed headings condition, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna dcbb344 18/72: Fixed up indenting, Ian Dunn, 2017/05/21