]> git.eshelyaron.com Git - emacs.git/commitdiff
automated/package-test.el (package-test-sort-by-dependence): New test
authorArtur Malabarba <bruce.connor.am@gmail.com>
Thu, 5 Feb 2015 21:47:49 +0000 (19:47 -0200)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Thu, 5 Feb 2015 22:12:47 +0000 (20:12 -0200)
test/ChangeLog
test/automated/package-test.el

index 1aa82a7a4aaa7d88b6c26d36e5803cb5c0daee7b..23c48708b6c57b85e155002036ce4d09250b2305 100644 (file)
@@ -1,6 +1,7 @@
 2015-02-05  Artur Malabarba  <bruce.connor.am@gmail.com>
 
        * automated/package-test.el (package-test-get-deps): Fix typo.
+       (package-test-sort-by-dependence): New test
 
 2015-02-03  Artur Malabarba  <bruce.connor.am@gmail.com>
 
index cf189dd6d344c78accdbf14d5fea55ed2a5ab1f6..7d2a343a0777c7aec5b77607eca656079b61a223 100644 (file)
@@ -526,6 +526,32 @@ Must called from within a `tar-mode' buffer."
      (equal (package--get-deps 'simple-depend-2 'direct)
             '(simple-depend-1 multi-file)))))
 
+(ert-deftest package-test-sort-by-dependence ()
+  "Test `package--sort-by-dependence' with complex structures."
+  (let ((package-alist
+         (mapcar (lambda (p) (list (package-desc-name p) p))
+           (list simple-single-desc
+                 simple-depend-desc
+                 multi-file-desc
+                 new-pkg-desc
+                 simple-depend-desc-1
+                 simple-depend-desc-2)))
+        (delete-list
+         (list simple-single-desc
+               simple-depend-desc
+               multi-file-desc
+               new-pkg-desc
+               simple-depend-desc-1
+               simple-depend-desc-2)))
+    (should
+     (equal (package--sort-by-dependence delete-list)
+            (list simple-depend-desc-2 simple-depend-desc-1 new-pkg-desc
+                  multi-file-desc simple-depend-desc simple-single-desc)))
+    (should
+     (equal (package--sort-by-dependence (reverse delete-list))
+            (list new-pkg-desc simple-depend-desc-2 simple-depend-desc-1
+                  multi-file-desc simple-depend-desc simple-single-desc)))))
+
 (provide 'package-test)
 
 ;;; package-test.el ends here