mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Apply changes from GNU ELPA
* doc/yas-doc-helper.el: * yasnippet-debug.el: * yasnippet-tests.el: Fix up copyright headers. * yasnippet-tests.el: Fix lexical-binding cookie. * yasnippet-debug.el: Require cl. * yasnippet-tests.el: Silence byte-compiler. (yas-saving-variables, yas-with-snippet-dirs): Move macros before their use. (yas--barbaz, yas--foobarbaz): Declare. (yas--phony-c-mode, yas--test-mode, yas--another-test-mode): Move out of deftest, so the byte-compiler understands they're defined.
This commit is contained in:
parent
80941c077f
commit
42601d2ff8
@ -1,6 +1,6 @@
|
||||
;;; yas-doc-helper.el --- Help generate documentation for YASnippet
|
||||
|
||||
;; Copyright (C) 2012 João Távora
|
||||
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: João Távora <joaotavora@gmail.com>
|
||||
;; Keywords: convenience
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;; yasnippet-debug.el --- debug functions for yasnippet
|
||||
|
||||
;; Copyright (C) 2010 João Távora
|
||||
;; Copyright (C) 2010, 2013, 2014 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: João Távora
|
||||
;; Keywords: emulations, convenience
|
||||
@ -25,6 +25,7 @@
|
||||
;;; Code:
|
||||
|
||||
(require 'yasnippet)
|
||||
(require 'cl)
|
||||
|
||||
(defun yas-debug-snippet-vars ()
|
||||
"Debug snippets, fields, mirrors and the `buffer-undo-list'."
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;; yasnippet-tests.el --- some yasnippet tests
|
||||
;;; yasnippet-tests.el --- some yasnippet tests -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2012 João Távora
|
||||
;; Copyright (C) 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: João Távora <joaot@siscog.pt>
|
||||
;; Keywords: emulations, convenience
|
||||
@ -27,6 +27,7 @@
|
||||
(require 'yasnippet)
|
||||
(require 'ert)
|
||||
(require 'ert-x)
|
||||
(require 'cl)
|
||||
|
||||
|
||||
;;; Snippet mechanics
|
||||
@ -275,6 +276,15 @@
|
||||
(and (buffer-name ,temp-buffer)
|
||||
(kill-buffer ,temp-buffer))))))))
|
||||
|
||||
(defmacro yas-saving-variables (&rest body)
|
||||
`(yas-call-with-saving-variables #'(lambda () ,@body)))
|
||||
|
||||
(defmacro yas-with-snippet-dirs (dirs &rest body)
|
||||
(declare (indent defun))
|
||||
`(yas-call-with-snippet-dirs ,dirs
|
||||
#'(lambda ()
|
||||
,@body)))
|
||||
|
||||
(ert-deftest example-for-issue-474 ()
|
||||
(yas--with-font-locked-temp-buffer
|
||||
(c-mode)
|
||||
@ -365,6 +375,9 @@ TODO: correct this bug!"
|
||||
"brother from another mother") ;; no newline should be here!
|
||||
)))
|
||||
|
||||
(defvar yas--barbaz)
|
||||
(defvar yas--foobarbaz)
|
||||
|
||||
;; See issue #497. To understand this test, follow the example of the
|
||||
;; `yas-key-syntaxes' docstring.
|
||||
;;
|
||||
@ -569,8 +582,9 @@ TODO: correct this bug!"
|
||||
(should (equal (sort expected-rest #'string<)
|
||||
(sort (cl-subseq observed (length expected-first)) #'string<))))))))
|
||||
|
||||
(ert-deftest issue-492-and-494 ()
|
||||
(defalias 'yas--phony-c-mode 'c-mode)
|
||||
|
||||
(ert-deftest issue-492-and-494 ()
|
||||
(define-derived-mode yas--test-mode yas--phony-c-mode "Just a test mode")
|
||||
(yas-with-snippet-dirs '((".emacs.d/snippets"
|
||||
("yas--test-mode")))
|
||||
@ -587,9 +601,10 @@ TODO: correct this bug!"
|
||||
(should (= (length expected)
|
||||
(length observed)))))))
|
||||
|
||||
(ert-deftest issue-504-tricky-jit ()
|
||||
(define-derived-mode yas--test-mode c-mode "Just a test mode")
|
||||
(define-derived-mode yas--another-test-mode c-mode "Another test mode")
|
||||
|
||||
(ert-deftest issue-504-tricky-jit ()
|
||||
(yas-with-snippet-dirs
|
||||
'((".emacs.d/snippets"
|
||||
("yas--another-test-mode"
|
||||
@ -880,10 +895,6 @@ add the snippets associated with the given mode."
|
||||
for saved in saved-values
|
||||
do (set var saved)))))
|
||||
|
||||
(defmacro yas-saving-variables (&rest body)
|
||||
`(yas-call-with-saving-variables #'(lambda () ,@body)))
|
||||
|
||||
|
||||
(defun yas-call-with-snippet-dirs (dirs fn)
|
||||
(let* ((default-directory (make-temp-file "yasnippet-fixture" t))
|
||||
(yas-snippet-dirs (mapcar #'car dirs)))
|
||||
@ -895,12 +906,6 @@ add the snippets associated with the given mode."
|
||||
(when (>= emacs-major-version 24)
|
||||
(delete-directory default-directory 'recursive))))))
|
||||
|
||||
(defmacro yas-with-snippet-dirs (dirs &rest body)
|
||||
(declare (indent defun))
|
||||
`(yas-call-with-snippet-dirs ,dirs
|
||||
#'(lambda ()
|
||||
,@body)))
|
||||
|
||||
;;; Older emacsen
|
||||
;;;
|
||||
(unless (fboundp 'special-mode)
|
||||
@ -939,7 +944,6 @@ attention to case differences."
|
||||
(provide 'yasnippet-tests)
|
||||
;; Local Variables:
|
||||
;; indent-tabs-mode: nil
|
||||
;; lexical-binding: t
|
||||
;; byte-compile-warnings: (not cl-functions)
|
||||
;; End:
|
||||
;;; yasnippet-tests.el ends here
|
||||
|
Loading…
x
Reference in New Issue
Block a user