From 6d767f961fe9f3bff9f59f5902db7925e6da19ef Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 3 Feb 2015 11:38:08 +0000 Subject: [PATCH] automated/package-test.el (package-test-get-deps): New test. --- test/ChangeLog | 4 +++ test/automated/package-test.el | 47 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/test/ChangeLog b/test/ChangeLog index a9834cc0f3f..56e3ac08e54 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2015-02-03 Artur Malabarba + + * automated/package-test.el (package-test-get-deps): New test. + 2015-01-31 Stefan Monnier * automated/eieio-tests.el (eieio-test-23-inheritance-check): Simplify. diff --git a/test/automated/package-test.el b/test/automated/package-test.el index a8488652c2f..004e2e89895 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -73,6 +73,24 @@ :kind 'single) "Expected `package-desc' parsed from new-pkg-1.0.el.") +(defvar simple-depend-desc-1 + (package-desc-create :name 'simple-depend-1 + :version '(1 0) + :summary "A single-file package with a dependency." + :kind 'single + :reqs '((simple-depend (1 0)) + (multi-file (0 1)))) + "`package-desc' used for testing dependencies.") + +(defvar simple-depend-desc-2 + (package-desc-create :name 'simple-depend-2 + :version '(1 0) + :summary "A single-file package with a dependency." + :kind 'single + :reqs '((simple-depend-1 (1 0)) + (multi-file (0 1)))) + "`package-desc' used for testing dependencies.") + (defvar package-test-data-dir (expand-file-name "data/package" package-test-file-dir) "Base directory of package test files.") @@ -479,6 +497,35 @@ Must called from within a `tar-mode' buffer." (should (equal archive-contents (list 1 package-x-test--single-archive-entry-1-4)))))) +(ert-deftest package-test-get-deps () + "Test `package-test-get-deps' 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)))) + (should + (equal (package--get-deps 'simple-depend) + '(simple-single))) + (should + (equal (package--get-deps 'simple-depend 'indirect) + nil)) + (should + (equal (package--get-deps 'simple-depend 'direct) + '(simple-single))) + (should + (equal (package--get-deps 'simple-depend-2) + '(simple-depend-1 multi-file simple-depend simple-single))) + (should + (equal (package--get-deps 'simple-depend-2 'indirect) + '(simple-depend multi-file simple-single))) + (should + (equal (package--get-deps 'simple-depend-2 'direct) + '(simple-depend-1 multi-file))))) + (provide 'package-test) ;;; package-test.el ends here -- 2.39.2