]> code.delx.au - gnu-emacs-elpa/commitdiff
Add (failing) yas--modes-to-activate test
authorNoam Postavsky <npostavs@users.sourceforge.net>
Sun, 11 Oct 2015 16:25:20 +0000 (12:25 -0400)
committerNoam Postavsky <npostavs@users.sourceforge.net>
Sun, 11 Oct 2015 17:08:53 +0000 (13:08 -0400)
* yasnippet-tests.el (extra-modes-parenthood): New (failing) test.
(loading-with-cyclic-parenthood): Use equal + sort instead of set
operation + length.

yasnippet-tests.el

index fbf79f8a82119668109dfa6ae42b5073074810df..47565718a9a12afa1d0714af3d713e11a3634554 100644 (file)
@@ -491,15 +491,40 @@ TODO: correct this bug!"
                           yet-another-c-mode
                           and-also-this-one
                           and-that-one
-                          ;; prog-mode doesn't exit in emacs 24.3
+                          ;; prog-mode doesn't exist in emacs 24.3
                           ,@(if (fboundp 'prog-mode)
                                 '(prog-mode))
                           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 (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"))
+                             ("cc-mode"
+                              (".yas-parents" . "yet-another-c-mode and-that-one"))
+                             ("yet-another-c-mode"
+                              (".yas-parents" . "c-mode and-also-this-one lisp-interaction-mode"))))
+     (yas-reload-all)
+     (with-temp-buffer
+       (let* ((_ (yas-activate-extra-mode 'c-mode))
+              (expected `(,major-mode
+                          c-mode
+                          cc-mode
+                          yet-another-c-mode
+                          and-also-this-one
+                          and-that-one
+                          ;; prog-mode doesn't exist in emacs 24.3
+                          ,@(if (fboundp 'prog-mode)
+                                '(prog-mode))
+                          emacs-lisp-mode
+                          lisp-interaction-mode))
+              (observed (yas--modes-to-activate)))
+         (should (equal (sort expected #'string<) (sort observed #'string<))))))))
 
 (ert-deftest issue-492-and-494 ()
   (defalias 'yas--phony-c-mode 'c-mode)