emacs-emojify

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

commit 465422e7c9ad9be6c0da8ed0aed2814c4f4d5e01
parent 5d62c7638cdf81df9f163168d719f29dba22be4f
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date:   Sat,  5 Mar 2016 22:43:35 +0530

Add tests for unicode emojis in programming modes

Diffstat:
Mtest/emojify-test.el | 49++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/test/emojify-test.el b/test/emojify-test.el @@ -40,7 +40,27 @@ (should (equal (get-text-property (point) 'emojify-buffer) (current-buffer))) (should (equal (get-text-property (point-min) 'emojify-beginning) (point-min-marker))) (should (equal (get-text-property (point) 'emojify-end) (point-max-marker))) - (should (equal (get-text-property (point) 'emojify-text) "😉")))) + (should (equal (get-text-property (point) 'emojify-text) "😉"))) + + (emojify-tests-with-emojified-static-buffer "😉" + ;; Emojis should be displayed by default in programming mode + (emacs-lisp-mode) + (emojify-tests-should-be-emojified (point-min)) + (should (equal (get-text-property (point) 'emojify-buffer) (current-buffer))) + (should (equal (get-text-property (point-min) 'emojify-beginning) (point-min-marker))) + (should (equal (get-text-property (point) 'emojify-end) (point-max-marker))) + (should (equal (get-text-property (point) 'emojify-text) "😉")) + + ;; Emojis should be displayed by default in non-programming mode + (fundamental-mode) + (emojify-redisplay-emojis-in-region) + (emojify-tests-should-be-emojified (point-min)) + + ;; Emojis should not be displayed if code is not an element in emojify-program-contexts + (setq emojify-program-contexts '()) + (emacs-lisp-mode) + (emojify-redisplay-emojis-in-region) + (emojify-tests-should-not-be-emojified (point-min)))) (ert-deftest emojify-tests-mixed-emoji-test () :tags '(core mixed) @@ -143,18 +163,22 @@ (ert-deftest emojify-tests-program-contexts () :tags '(core prog contextual) - (emojify-tests-with-emojified-static-buffer ";; :) :smile:\n\":smile:\"\n8)" + (emojify-tests-with-emojified-static-buffer ";; :) :smile:\n\":smile:\"\n8) 💜 :smile:" (let* ((comment-ascii-emoji-pos (+ 3 (point-min))) (comment-github-emoji-pos (+ comment-ascii-emoji-pos (length ":) "))) (string-github-emoji-pos (1+ (line-beginning-position 2))) - (prog-ascii-emoji-pos (1+ (line-beginning-position 3)))) + (prog-ascii-emoji-pos (line-beginning-position 3)) + (prog-unicode-emoji-pos (+ 3 prog-ascii-emoji-pos)) + (prog-github-emoji-pos (+ 2 prog-unicode-emoji-pos))) (emacs-lisp-mode) - (setq emojify-program-contexts '(comments string)) + (setq emojify-program-contexts '(comments string code)) (emojify-redisplay-emojis-in-region) (emojify-tests-should-be-emojified comment-ascii-emoji-pos) (emojify-tests-should-be-emojified comment-github-emoji-pos) (emojify-tests-should-be-emojified string-github-emoji-pos) (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos) + (emojify-tests-should-be-emojified prog-unicode-emoji-pos) + (emojify-tests-should-not-be-emojified prog-github-emoji-pos) (setq emojify-program-contexts '(comments)) (emojify-redisplay-emojis-in-region) @@ -162,6 +186,8 @@ (emojify-tests-should-be-emojified comment-github-emoji-pos) (emojify-tests-should-not-be-emojified string-github-emoji-pos) (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos) + (emojify-tests-should-not-be-emojified prog-unicode-emoji-pos) + (emojify-tests-should-not-be-emojified prog-github-emoji-pos) (setq emojify-program-contexts '(string)) (emojify-redisplay-emojis-in-region) @@ -169,13 +195,26 @@ (emojify-tests-should-not-be-emojified comment-github-emoji-pos) (emojify-tests-should-be-emojified string-github-emoji-pos) (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos) + (emojify-tests-should-not-be-emojified prog-unicode-emoji-pos) + (emojify-tests-should-not-be-emojified prog-github-emoji-pos) + + (setq emojify-program-contexts '(code)) + (emojify-redisplay-emojis-in-region) + (emojify-tests-should-not-be-emojified comment-ascii-emoji-pos) + (emojify-tests-should-not-be-emojified comment-github-emoji-pos) + (emojify-tests-should-not-be-emojified string-github-emoji-pos) + (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos) + (emojify-tests-should-be-emojified prog-unicode-emoji-pos) + (emojify-tests-should-not-be-emojified prog-github-emoji-pos) (setq emojify-program-contexts '()) (emojify-redisplay-emojis-in-region) (emojify-tests-should-not-be-emojified comment-ascii-emoji-pos) (emojify-tests-should-not-be-emojified comment-github-emoji-pos) (emojify-tests-should-not-be-emojified string-github-emoji-pos) - (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos)))) + (emojify-tests-should-not-be-emojified prog-ascii-emoji-pos) + (emojify-tests-should-not-be-emojified prog-unicode-emoji-pos) + (emojify-tests-should-not-be-emojified prog-github-emoji-pos)))) (ert-deftest emojify-tests-ascii-emoji-contexts () :tags '(core text contextual)