summaryrefslogtreecommitdiff
path: root/bog-tests.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-12-11 00:19:01 -0500
committerKyle Meyer <kyle@kyleam.com>2014-12-11 00:19:01 -0500
commit7688cb0c61a757baab5fe830ed12520cb54756ae (patch)
tree9110bc35caf13e0ae6fab0d9b7b7fa6ca27bba0e /bog-tests.el
parentebef5b183c959c2e228ca4c7f8107bec517d2582 (diff)
downloadbog-7688cb0c61a757baab5fe830ed12520cb54756ae.tar.gz
Add commands bog-{next,previous}-non-heading-citekey
Diffstat (limited to 'bog-tests.el')
-rw-r--r--bog-tests.el59
1 files changed, 59 insertions, 0 deletions
diff --git a/bog-tests.el b/bog-tests.el
index 0173c5f..91bf252 100644
--- a/bog-tests.el
+++ b/bog-tests.el
@@ -254,6 +254,65 @@ some text and <point><citekey>"
** second"
(should-not (bog-citekey-from-surroundings))))
+;; bog-{next,previous}-non-heading-citekey
+
+(ert-deftest bog-next-non-heading-citekey-default-arg ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "
+<point>
+<citekey> other2000key"
+ (bog-next-non-heading-citekey)
+ (should (equal citekey (bog-citekey-at-point))))))
+
+(ert-deftest bog-next-non-heading-citekey-pos-arg ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "
+<point>
+other2000key <citekey>"
+ (bog-next-non-heading-citekey 2)
+ (should (equal citekey (bog-citekey-at-point))))))
+
+(ert-deftest bog-next-non-heading-citekey-on-citekey ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "
+<point>other2000key
+<citekey>"
+ (bog-next-non-heading-citekey)
+ (should (equal citekey (bog-citekey-at-point))))))
+
+(ert-deftest bog-next-non-heading-citekey-pos-neg-arg ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "<citekey> <point>"
+ (bog-next-non-heading-citekey -1)
+ (should (equal citekey (bog-citekey-at-point))))))
+
+(ert-deftest bog-previous-non-heading-citekey-default-arg ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "other2000key <citekey> <point>"
+ (bog-previous-non-heading-citekey)
+ (should (equal citekey (bog-citekey-at-point))))))
+
+(ert-deftest bog-previous-non-heading-citekey-on-citekey ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "
+<citekey>
+<point>other2000key"
+ (bog-previous-non-heading-citekey)
+ (should (equal citekey (bog-citekey-at-point))))))
+
+(ert-deftest bog-previous-non-heading-citekey-pos-arg ()
+ (let ((citekey "name2010word"))
+ (bog-tests--with-temp-text
+ "<citekey> other2000key <point>"
+ (bog-previous-non-heading-citekey 2)
+ (should (equal citekey (bog-citekey-at-point))))))
+
;;; File functions