commit a430d0a4607e160fbda822c2740264d8efc6cef1
parent 76acfa25126342d10a4b9e1fae08c1b09e32d403
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date: Tue, 27 Sep 2016 22:09:15 +0530
Update tests, remove test for multiple isearches
Diffstat:
2 files changed, 21 insertions(+), 41 deletions(-)
diff --git a/test/emojify-test.el b/test/emojify-test.el
@@ -7,8 +7,7 @@
;;; Code:
;; For interactive testing
-(unless noninteractive
- (require 'test-helper (expand-file-name "test-helper.el")))
+(require 'test-helper (expand-file-name "test-helper.el"))
;; Used for testing integration with programming modes
(require 'org)
@@ -96,7 +95,7 @@
:tags '(behaviour point-motion)
(emojify-tests-with-emojified-buffer " :)"
(setq emojify-point-entered-behaviour 'uncover)
- (goto-char (1+ (point-min)))
+ (execute-kbd-macro (kbd "C-f") 2)
(emojify-tests-should-be-uncovered (point))))
(ert-deftest emojify-tests-emoji-echoing ()
@@ -107,11 +106,10 @@
;; before echoing the emoji, we need to stub out current-message
;; too otherwise emojify does not echo the message since messages
;; from other tests are being displayed
- (unless noninteractive
- (stub current-message => nil))
+ (stub current-message => nil)
(mock (message ":)"))
(setq emojify-point-entered-behaviour 'echo)
- (goto-char (1+ (point-min)))
+ (execute-kbd-macro (kbd "C-f"))
(emojify-tests-should-be-emojified (point)))))
(ert-deftest emojify-tests-custom-point-entered-function ()
@@ -399,49 +397,27 @@
:tags '(isearch)
(emojify-tests-with-emojified-buffer "Testing isearch\n:books:"
(with-mock
+ (setq emojify-reveal-on-isearch t)
;; We do not want to be bothered with isearch messages
(stub message => nil)
(emojify-tests-should-be-emojified (line-beginning-position 2))
(isearch-mode +1)
- (execute-kbd-macro ":book")
+ (execute-kbd-macro "boo")
;; Emoji should be uncovered when point enters it in isearch-mode
(emojify-tests-should-be-uncovered (line-beginning-position))
- (isearch-exit)
;; Emoji should be restored on leaving the underlying text
- (goto-char (point-min))
- (emojify-tests-should-be-emojified (line-beginning-position 2)))))
+ (execute-kbd-macro "")
+ (emojify-tests-should-be-emojified (line-beginning-position 2))
-(ert-deftest emojify-tests-uncover-on-isearch-multiple-matches ()
- :tags '(isearch)
- (emojify-tests-with-emojified-buffer "Testing isearch\n:book:\n:books:"
- (let ((first-emoji-pos (line-beginning-position 2))
- (second-emoji-pos (line-beginning-position 3)))
- (with-mock
- ;; We do not want to be bothered with isearch messages
- (stub message => nil)
- (emojify-tests-should-be-emojified first-emoji-pos)
- (emojify-tests-should-be-emojified second-emoji-pos)
-
- (isearch-mode +1)
- ;; isearch-printing-char in Emacs 24.3 did not accept
- ;; any arguments
- (let ((last-command-event ?b)) (isearch-printing-char))
- (let ((last-command-event ?o)) (isearch-printing-char))
-
- ;; TODO: For some reason first one actually repeats backwards when
- ;; called non-interactively As such 2 more repeats are needed first to
- ;; go back to first match and second to actually search forward
- (isearch-repeat 'forward)
- (isearch-repeat 'forward)
- (isearch-repeat 'forward)
-
- (emojify-tests-should-be-emojified first-emoji-pos)
- (emojify-tests-should-be-uncovered second-emoji-pos)
- (isearch-exit)
- ;; Emoji should be restored on leaving the underlying text
- (goto-char (point-min))
- (emojify-tests-should-be-emojified first-emoji-pos)
- (emojify-tests-should-be-emojified second-emoji-pos)))))
+ ;; Turn off revealing on isearch
+ (setq emojify-reveal-on-isearch nil)
+ ;; We do not want to be bothered with isearch messages
+ (stub message => nil)
+ (emojify-tests-should-be-emojified (line-beginning-position 2))
+ (isearch-mode +1)
+ (execute-kbd-macro "boo")
+ ;; Emoji should be uncovered when point enters it in isearch-mode
+ (emojify-tests-should-be-emojified (line-beginning-position)))))
(ert-deftest emojify-tests-electric-delete ()
:tags '(electric-delete)
diff --git a/test/test-helper.el b/test/test-helper.el
@@ -22,6 +22,8 @@
;; Libs required for tests
(require 'ert)
(require 'el-mock)
+(eval-when-compile
+ (require 'cl))
(require 'cl-lib)
(require 'noflet)
@@ -56,6 +58,7 @@ Helps isolate tests from each other's customizations."
(emojify-saved-inhibit-functions emojify-inhibit-functions)
(emojify-saved-point-entered-behaviour emojify-point-entered-behaviour)
(emojify-saved-show-help emojify-show-help)
+ (emojify-saved-reveal-on-isearch emojify-reveal-on-isearch)
(emojify-saved-composed-text-p emojify-composed-text-p))
(unwind-protect
(progn
@@ -75,6 +78,7 @@ Helps isolate tests from each other's customizations."
emojify-inhibit-functions emojify-saved-inhibit-functions
emojify-point-entered-behaviour emojify-saved-point-entered-behaviour
emojify-show-help emojify-saved-show-help
+ emojify-reveal-on-isearch emojify-saved-reveal-on-isearch
emojify-composed-text-p emojify-saved-composed-text-p)
(emojify-set-emoji-styles emojify-saved-emoji-style))))