emacs-emojify

fork of https://github.com/iqbalansari/emacs-emojify
Log | Files | Refs | LICENSE

commit 429cfe9e16049ca0c5ef0d81f84f14cfc5ad2fff
parent a0bcb2fb855745ec1cecdf9e19e399abc9729672
Author: Iqbal Ansari <iqbal.ansari@ignitesol.com>
Date:   Tue,  3 Nov 2015 14:09:25 +0530

More tests for after-change-functions

Diffstat:
Mtest/emojify-test.el | 30++++++++++++++++++++++++------
Mtest/test-helper.el | 5+++++
2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/test/emojify-test.el b/test/emojify-test.el @@ -33,8 +33,8 @@ (should (equal (get-text-property (point) 'emojify-end) (point-max))) (should (equal (get-text-property (point) 'emojify-text) ":smile:")))) -(ert-deftest emojify-tests-emojifying-after-change () - :tags '(github simple) +(ert-deftest emojify-tests-emojifying-on-comment-uncomment () + :tags '(core after-change) (emojify-tests-with-emojified-buffer ":smile:\n:)" (emacs-lisp-mode) (emojify-redisplay-emojis) @@ -44,7 +44,25 @@ (comment-region (point-min) (point-max)) (emojify-tests-should-be-emojified (+ 3 (line-beginning-position))) - (emojify-tests-should-be-emojified (+ 3 (line-beginning-position 2))))) + (emojify-tests-should-be-emojified (+ 3 (line-beginning-position 2))) + + (uncomment-region (point-min) (point-max)) + (emojify-tests-should-not-be-emojified (line-beginning-position)) + (emojify-tests-should-not-be-emojified (line-beginning-position 2)))) + +(ert-deftest emojify-tests-emojifying-on-typing () + :tags '(core after-change) + (emojify-tests-with-emojified-buffer "" + (emacs-lisp-mode) + (emojify-redisplay-emojis) + (emojify-mode +1) + (emojify-insert-string "; :)") + (emojify-tests-should-be-emojified 4) + (newline) + (emojify-insert-string "; :smile") + (emojify-tests-should-not-be-emojified (+ 4 (line-beginning-position))) + (emojify-insert-string ":") + (emojify-tests-should-be-emojified (+ 4 (line-beginning-position))))) (ert-deftest emojify-tests-emoji-uncovering () :tags '(behaviour point-motion) @@ -103,7 +121,7 @@ (emojify-tests-should-be-emojified github-emoji-pos)))) (ert-deftest emojify-tests-prog-contexts () - :tags '(prog contextual) + :tags '(core prog contextual) (emojify-tests-with-emojified-static-buffer ";; :) :smile:\n\":smile:\"\n8)" (let* ((comment-ascii-emoji-pos (+ 3 (point-min))) (comment-github-emoji-pos (+ comment-ascii-emoji-pos (length ":) "))) @@ -139,7 +157,7 @@ (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos)))) (ert-deftest emojify-tests-text-contexts () - :tags '(text contextual) + :tags '(core text contextual) ;; At start of comment (emojify-tests-with-emojified-static-buffer ";:smile:" (emacs-lisp-mode) @@ -199,7 +217,7 @@ (emojify-tests-should-not-be-emojified (+ 2 (point-min))))) (ert-deftest emojify-tests-emojifying-lists () - :tags '(contextual) + :tags '(core contextual) (emojify-tests-with-emojified-static-buffer ":]" (emojify-tests-should-be-emojified (point-min))) diff --git a/test/test-helper.el b/test/test-helper.el @@ -122,5 +122,10 @@ Helps isolate tests from each other's customizations." (should-not (get-text-property ,point 'display)) (should-not (get-text-property ,point 'point-entered)))) +(defun emojify-insert-string (string) + (mapc (lambda (character) + (insert character)) + (string-to-vector string))) + (provide 'test-helper) ;;; test-helper.el ends here