From de840e433c8de436fcbbe0a9eb3fbde0b2a33070 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 5 Feb 2015 19:47:49 -0200 Subject: [PATCH] automated/package-test.el (package-test-sort-by-dependence): New test --- test/ChangeLog | 1 + test/automated/package-test.el | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/test/ChangeLog b/test/ChangeLog index 1aa82a7a4aa..23c48708b6c 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,7 @@ 2015-02-05 Artur Malabarba * automated/package-test.el (package-test-get-deps): Fix typo. + (package-test-sort-by-dependence): New test 2015-02-03 Artur Malabarba diff --git a/test/automated/package-test.el b/test/automated/package-test.el index cf189dd6d34..7d2a343a077 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -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 -- 2.39.2