From de5d4f39ad1055b18c74ac516244b5ba4a6d45ce Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sun, 18 Sep 2016 14:22:03 +0200 Subject: [PATCH] Remove conditional tests for 24.3 --- test/smartparens-commands-test.el | 3 +- test/smartparens-delayed-hook-test.el | 133 +++++++++++++------------- test/smartparens-get-thing-test.el | 22 ++--- test/smartparens-insertion-test.el | 9 +- test/smartparens-ruby-mode-test.el | 13 ++- 5 files changed, 85 insertions(+), 95 deletions(-) diff --git a/test/smartparens-commands-test.el b/test/smartparens-commands-test.el index f66fc6d4..5367f54e 100644 --- a/test/smartparens-commands-test.el +++ b/test/smartparens-commands-test.el @@ -39,8 +39,7 @@ be." "Run the test for COMMAND." ;; TODO: get rid of this (unless (and (boundp 'mode) - (eq mode 'racket) - (version<= "24.3" emacs-version)) + (eq mode 'racket)) (shut-up (cl-dolist (example examples) (let ((before (car example))) diff --git a/test/smartparens-delayed-hook-test.el b/test/smartparens-delayed-hook-test.el index f3be12aa..3310b812 100644 --- a/test/smartparens-delayed-hook-test.el +++ b/test/smartparens-delayed-hook-test.el @@ -1,73 +1,70 @@ -;; TODO: no idea why cl-letf doesn't work on 24.3. The error is: -;; (void-function sp-test-insert-space) -(when (version<= "24.4" emacs-version) - (ert-deftest sp-test-delayed-hook-should-trigger-on-RET () - (cl-letf (((symbol-function 'sp-test-insert-space) - (lambda (&rest _) - (insert " ")))) - (let ((sp-pairs '((emacs-lisp-mode - (:open "(" :close ")" :actions (insert wrap autoskip navigate) - :post-handlers ((sp-test-insert-space "RET"))))))) - (sp-test-with-temp-elisp-buffer "" - (execute-kbd-macro "(") - (execute-kbd-macro (kbd "RET")) - (insert "|") - (should (equal (buffer-string) "( +(ert-deftest sp-test-delayed-hook-should-trigger-on-RET () + (cl-letf (((symbol-function 'sp-test-insert-space) + (lambda (&rest _) + (insert " ")))) + (let ((sp-pairs '((emacs-lisp-mode + (:open "(" :close ")" :actions (insert wrap autoskip navigate) + :post-handlers ((sp-test-insert-space "RET"))))))) + (sp-test-with-temp-elisp-buffer "" + (execute-kbd-macro "(") + (execute-kbd-macro (kbd "RET")) + (insert "|") + (should (equal (buffer-string) "( |)")))))) - (ert-deftest sp-test-delayed-hook-should-not-trigger-on-a () - (cl-letf (((symbol-function 'sp-test-insert-space) - (lambda (&rest _) - (insert " ")))) - (let ((sp-pairs '((emacs-lisp-mode - (:open "(" :close ")" :actions (insert wrap autoskip navigate) - :post-handlers ((sp-test-insert-space "RET"))))))) - (sp-test-with-temp-elisp-buffer "" - (execute-kbd-macro "(") - (execute-kbd-macro (kbd "a")) - (insert "|") - (should (equal (buffer-string) "(a|)")))))) +(ert-deftest sp-test-delayed-hook-should-not-trigger-on-a () + (cl-letf (((symbol-function 'sp-test-insert-space) + (lambda (&rest _) + (insert " ")))) + (let ((sp-pairs '((emacs-lisp-mode + (:open "(" :close ")" :actions (insert wrap autoskip navigate) + :post-handlers ((sp-test-insert-space "RET"))))))) + (sp-test-with-temp-elisp-buffer "" + (execute-kbd-macro "(") + (execute-kbd-macro (kbd "a")) + (insert "|") + (should (equal (buffer-string) "(a|)")))))) - (ert-deftest sp-test-delayed-hook-should-trigger-on-my/newline () - (cl-letf (((symbol-function 'my/test-newline) - (lambda (&rest _) - (interactive) - (insert "\n"))) - ((symbol-function 'sp-test-insert-space) - (lambda (&rest _) - (insert " ")))) - (let ((sp-pairs '((emacs-lisp-mode - (:open "(" :close ")" :actions (insert wrap autoskip navigate) - :post-handlers ((sp-test-insert-space my/test-newline))))))) - (sp-test-with-temp-elisp-buffer "" - (execute-kbd-macro "(") - (setq this-command 'my/test-newline) - (call-interactively 'my/test-newline) - (run-hooks 'post-command-hook) - (insert "|") - (should (equal (buffer-string) "( +(ert-deftest sp-test-delayed-hook-should-trigger-on-my/newline () + (cl-letf (((symbol-function 'my/test-newline) + (lambda (&rest _) + (interactive) + (insert "\n"))) + ((symbol-function 'sp-test-insert-space) + (lambda (&rest _) + (insert " ")))) + (let ((sp-pairs '((emacs-lisp-mode + (:open "(" :close ")" :actions (insert wrap autoskip navigate) + :post-handlers ((sp-test-insert-space my/test-newline))))))) + (sp-test-with-temp-elisp-buffer "" + (execute-kbd-macro "(") + (setq this-command 'my/test-newline) + (call-interactively 'my/test-newline) + (run-hooks 'post-command-hook) + (insert "|") + (should (equal (buffer-string) "( |)")))))) - (ert-deftest sp-test-delayed-hook-should-not-trigger-on-newline () - (cl-letf (((symbol-function 'my/test-newline) - (lambda (&rest _) - (interactive) - (insert "\n"))) - ((symbol-function 'newline) - (lambda (&rest _) - (interactive) - (insert "\n"))) - ((symbol-function 'sp-test-insert-space) - (lambda (&rest _) - (insert " ")))) - (let ((sp-pairs '((emacs-lisp-mode - (:open "(" :close ")" :actions (insert wrap autoskip navigate) - :post-handlers ((sp-test-insert-space my/test-newline))))))) - (sp-test-with-temp-elisp-buffer "" - (execute-kbd-macro "(") - (setq this-command 'newline) - (call-interactively 'newline) - (run-hooks 'post-command-hook) - (insert "|") - (should (equal (buffer-string) "( -|)"))))))) +(ert-deftest sp-test-delayed-hook-should-not-trigger-on-newline () + (cl-letf (((symbol-function 'my/test-newline) + (lambda (&rest _) + (interactive) + (insert "\n"))) + ((symbol-function 'newline) + (lambda (&rest _) + (interactive) + (insert "\n"))) + ((symbol-function 'sp-test-insert-space) + (lambda (&rest _) + (insert " ")))) + (let ((sp-pairs '((emacs-lisp-mode + (:open "(" :close ")" :actions (insert wrap autoskip navigate) + :post-handlers ((sp-test-insert-space my/test-newline))))))) + (sp-test-with-temp-elisp-buffer "" + (execute-kbd-macro "(") + (setq this-command 'newline) + (call-interactively 'newline) + (run-hooks 'post-command-hook) + (insert "|") + (should (equal (buffer-string) "( +|)")))))) diff --git a/test/smartparens-get-thing-test.el b/test/smartparens-get-thing-test.el index e89c45e3..38725649 100644 --- a/test/smartparens-get-thing-test.el +++ b/test/smartparens-get-thing-test.el @@ -1,6 +1,5 @@ ;; Get thing tests -(when (version< "24.3" emacs-version) - (shut-up (load "auctex-autoloads"))) +(shut-up (load "auctex-autoloads")) (defun sp-test-thing-parse-in-latex (initial result) (sp-test-with-temp-buffer initial @@ -18,15 +17,14 @@ (sp-test-thing-parse-in-latex "foo | \\bar {baz} qux" '(:beg 7 :end 10 :op "" :cl "" :prefix "\\" :suffix "")) )) -(when (version<= "24.3" emacs-version) - (require 'racket-mode) +(require 'racket-mode) - (defun sp-test-thing-parse-in-racket (initial result) - (sp-test-with-temp-buffer initial - (racket-mode) - (should (equal (sp-get-thing) result)))) +(defun sp-test-thing-parse-in-racket (initial result) + (sp-test-with-temp-buffer initial + (racket-mode) + (should (equal (sp-get-thing) result)))) - (ert-deftest sp-test-get-thing-racket nil - (let ((sp-sexp-prefix '((racket-mode regexp "#?['`,]@?"))) - (sp-pairs '((t . ((:open "(" :close ")" :actions (insert wrap autoskip navigate))))))) - (sp-test-thing-parse-in-racket "foo | #'(foo) qux" '(:beg 8 :end 13 :op "(" :cl ")" :prefix "#'" :suffix ""))))) +(ert-deftest sp-test-get-thing-racket nil + (let ((sp-sexp-prefix '((racket-mode regexp "#?['`,]@?"))) + (sp-pairs '((t . ((:open "(" :close ")" :actions (insert wrap autoskip navigate))))))) + (sp-test-thing-parse-in-racket "foo | #'(foo) qux" '(:beg 8 :end 13 :op "(" :cl ")" :prefix "#'" :suffix "")))) diff --git a/test/smartparens-insertion-test.el b/test/smartparens-insertion-test.el index b663cf11..688da46e 100644 --- a/test/smartparens-insertion-test.el +++ b/test/smartparens-insertion-test.el @@ -46,8 +46,7 @@ ;; and 24.2 but it's a waste of time. If some users are on those ;; versions, they are welcome to figure it out for us :) (ert-deftest sp-test-insertion-latex nil - (when (version< "24.3" emacs-version) - (shut-up (load "auctex-autoloads"))) + (shut-up (load "auctex-autoloads")) (let ((sp-undo-pairs-separately nil) (sp-pairs '((latex-mode (:open "$" :close "$" :actions (insert wrap autoskip navigate)) @@ -58,8 +57,7 @@ (:open "`" :close "'" :actions (insert wrap autoskip navigate)))))) (sp-test-latex-insertion "|" "$" "$$") (sp-test-latex-insertion "|" "`" "`'") - (when (version< "24.3" emacs-version) - (sp-test-latex-insertion "|" "$$" "$$")) + (sp-test-latex-insertion "|" "$$" "$$") (sp-test-latex-insertion "|" "$foo$$foo" "$foo$$foo$") (sp-test-latex-insertion "foo |" "$" "foo $$") (sp-test-latex-insertion "|" "\\[" "\\[\\]") @@ -67,8 +65,7 @@ (sp-test-latex-insertion "|" "[" "[]") (sp-test-latex-insertion "foo | bar" "\\bigl(" "foo \\bigl(\\bigr) bar") (sp-test-latex-insertion "foo | bar" "``" "foo ``'' bar") - (when (version< "24.3" emacs-version) - (sp-test-latex-insertion "foo | bar" "\"" "foo ``'' bar")) + (sp-test-latex-insertion "foo | bar" "\"" "foo ``'' bar") )) (defun sp-test--pair-to-insert (initial expected) diff --git a/test/smartparens-ruby-mode-test.el b/test/smartparens-ruby-mode-test.el index dc97d14a..a6c93b1f 100644 --- a/test/smartparens-ruby-mode-test.el +++ b/test/smartparens-ruby-mode-test.el @@ -5,18 +5,17 @@ (replace-regexp-in-string "^ *" "" b))) -(when (version< "24.3" emacs-version) - (ert-deftest sp-test-ruby-delete-pair () - (sp-test-with-temp-buffer "class Foo +(ert-deftest sp-test-ruby-delete-pair () + (sp-test-with-temp-buffer "class Foo def foo_for| end end" - (ruby-mode) - (execute-kbd-macro (kbd "|")) - (should (equal (buffer-string) "class Foo + (ruby-mode) + (execute-kbd-macro (kbd "|")) + (should (equal (buffer-string) "class Foo def foo_fo| end -end"))))) +end")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; basic pairs