mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 05:03:04 +00:00
Unbreak unit tests under Emacs 28.
- Emacs 28 has a new mode ‘lisp-data-mode’ for Lisp data. - A test that was temporarily broken passes again. - The default for ‘org-adapt-indentation’ has changed.
This commit is contained in:
parent
5cbdbf0d20
commit
1ca316fb6d
@ -1,6 +1,6 @@
|
|||||||
;;; yasnippet-tests.el --- some yasnippet tests -*- lexical-binding: t -*-
|
;;; yasnippet-tests.el --- some yasnippet tests -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 2012-2015, 2017-2018 Free Software Foundation, Inc.
|
;; Copyright (C) 2012-2015, 2017-2018, 2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;; Author: João Távora <joaot@siscog.pt>
|
;; Author: João Távora <joaot@siscog.pt>
|
||||||
;; Keywords: emulations, convenience
|
;; Keywords: emulations, convenience
|
||||||
@ -556,16 +556,19 @@ XXXXX ------------------------"))))
|
|||||||
(yas-mock-insert "foo bar")
|
(yas-mock-insert "foo bar")
|
||||||
(ert-simulate-command '(yas-next-field))
|
(ert-simulate-command '(yas-next-field))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((expected (with-temp-buffer
|
;; The default value of `org-adapt-indentation' changed between Org-mode 9.4
|
||||||
(insert (format (concat "* Test foo bar\n"
|
;; and 9.5, so force a specific value.
|
||||||
" " org-property-format "\n"
|
(let* ((org-adapt-indentation nil)
|
||||||
" " org-property-format "\n"
|
(expected (with-temp-buffer
|
||||||
" " org-property-format)
|
(insert (format (concat "* Test foo bar\n"
|
||||||
":PROPERTIES:" ""
|
org-property-format "\n"
|
||||||
":ID:" "foo bar-after"
|
org-property-format "\n"
|
||||||
":END:" ""))
|
org-property-format)
|
||||||
(delete-trailing-whitespace)
|
":PROPERTIES:" ""
|
||||||
(buffer-string))))
|
":ID:" "foo bar-after"
|
||||||
|
":END:" ""))
|
||||||
|
(delete-trailing-whitespace)
|
||||||
|
(buffer-string))))
|
||||||
;; Some org-mode versions leave trailing whitespace, some don't.
|
;; Some org-mode versions leave trailing whitespace, some don't.
|
||||||
(delete-trailing-whitespace)
|
(delete-trailing-whitespace)
|
||||||
(should (equal expected (buffer-string))))))
|
(should (equal expected (buffer-string))))))
|
||||||
@ -1390,7 +1393,9 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
|
|||||||
,@(if (fboundp 'prog-mode)
|
,@(if (fboundp 'prog-mode)
|
||||||
'(prog-mode))
|
'(prog-mode))
|
||||||
emacs-lisp-mode
|
emacs-lisp-mode
|
||||||
lisp-interaction-mode))
|
lisp-interaction-mode
|
||||||
|
;; `lisp-data-mode' doesn't exist prior to Emacs 28.
|
||||||
|
,@(and (fboundp 'lisp-data-mode) '(lisp-data-mode))))
|
||||||
(observed (yas--modes-to-activate)))
|
(observed (yas--modes-to-activate)))
|
||||||
(should (equal major-mode (car observed)))
|
(should (equal major-mode (car observed)))
|
||||||
(should (equal (sort expected #'string<) (sort observed #'string<))))))))
|
(should (equal (sort expected #'string<) (sort observed #'string<))))))))
|
||||||
@ -1418,7 +1423,11 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
|
|||||||
'(prog-mode))
|
'(prog-mode))
|
||||||
emacs-lisp-mode
|
emacs-lisp-mode
|
||||||
and-also-this-one
|
and-also-this-one
|
||||||
lisp-interaction-mode))
|
lisp-interaction-mode
|
||||||
|
;; `lisp-data-mode' doesn't exist prior to
|
||||||
|
;; Emacs 28.
|
||||||
|
,@(and (fboundp 'lisp-data-mode)
|
||||||
|
'(lisp-data-mode))))
|
||||||
(observed (yas--modes-to-activate)))
|
(observed (yas--modes-to-activate)))
|
||||||
(should (equal expected-first
|
(should (equal expected-first
|
||||||
(cl-subseq observed 0 (length expected-first))))
|
(cl-subseq observed 0 (length expected-first))))
|
||||||
@ -1691,9 +1700,11 @@ TODO: be meaner"
|
|||||||
"Test expansion of snippets in org source blocks."
|
"Test expansion of snippets in org source blocks."
|
||||||
;; org 9+ no longer runs fontification for text-mode, so our hacks
|
;; org 9+ no longer runs fontification for text-mode, so our hacks
|
||||||
;; don't work. Note that old ert doesn't have skipping, so we have
|
;; don't work. Note that old ert doesn't have skipping, so we have
|
||||||
;; to expect failure instead.
|
;; to expect failure instead. Starting with Org-mode 9.5 this seems
|
||||||
|
;; to work again.
|
||||||
:expected-result (if (and (fboundp 'org-in-src-block-p)
|
:expected-result (if (and (fboundp 'org-in-src-block-p)
|
||||||
(version< (org-version) "9"))
|
(or (version< (org-version) "9")
|
||||||
|
(version<= "9.5" (org-version))))
|
||||||
:passed :failed)
|
:passed :failed)
|
||||||
(let ((text-mode-hook #'yas-minor-mode))
|
(let ((text-mode-hook #'yas-minor-mode))
|
||||||
(do-yas-org-native-tab-in-source-block "text")))
|
(do-yas-org-native-tab-in-source-block "text")))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user