"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.
- ;;
+ ;;
(ert-deftest complicated-yas-key-syntaxes ()
(with-temp-buffer
(yas-saving-variables
emacs-lisp-mode
lisp-interaction-mode))
(observed (yas--modes-to-activate)))
- (should (null (cl-set-exclusive-or expected observed)))
- (should (= (length expected)
- (length observed))))))))
+ (should (equal major-mode (car observed)))
+ (should (equal (sort expected #'string<) (sort observed #'string<))))))))
+
+ (ert-deftest extra-modes-parenthood ()
+ "Test activation of parents of `yas--extra-modes'."
+ (yas-saving-variables
+ (yas-with-snippet-dirs '((".emacs.d/snippets"
+ ("c-mode"
+ (".yas-parents" . "cc-mode"))
+ ("yet-another-c-mode"
+ (".yas-parents" . "c-mode and-also-this-one lisp-interaction-mode"))))
+ (yas-reload-all)
+ (with-temp-buffer
+ (yas-activate-extra-mode 'c-mode)
+ (yas-activate-extra-mode 'yet-another-c-mode)
+ (yas-activate-extra-mode 'and-that-one)
+ (let* ((expected-first `(and-that-one
+ yet-another-c-mode
+ c-mode
+ ,major-mode))
+ (expected-rest `(cc-mode
+ ;; prog-mode doesn't exist in emacs 24.3
+ ,@(if (fboundp 'prog-mode)
+ '(prog-mode))
+ emacs-lisp-mode
+ and-also-this-one
+ lisp-interaction-mode))
+ (observed (yas--modes-to-activate)))
+ (should (equal expected-first
+ (cl-subseq observed 0 (length expected-first))))
+ (should (equal (sort expected-rest #'string<)
+ (sort (cl-subseq observed (length expected-first)) #'string<))))))))
+(defalias 'yas--phony-c-mode 'c-mode)
+
(ert-deftest issue-492-and-494 ()
- (defalias 'yas--phony-c-mode 'c-mode)
(define-derived-mode yas--test-mode yas--phony-c-mode "Just a test mode")
(yas-with-snippet-dirs '((".emacs.d/snippets"
("yas--test-mode")))