1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

automated/package-test.el (package-test-get-deps): New test.

This commit is contained in:
Artur Malabarba 2015-02-03 11:38:08 +00:00
parent 2a4a94db1a
commit 6d767f961f
2 changed files with 51 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2015-02-03 Artur Malabarba <bruce.connor.am@gmail.com>
* automated/package-test.el (package-test-get-deps): New test.
2015-01-31 Stefan Monnier <monnier@iro.umontreal.ca> 2015-01-31 Stefan Monnier <monnier@iro.umontreal.ca>
* automated/eieio-tests.el (eieio-test-23-inheritance-check): Simplify. * automated/eieio-tests.el (eieio-test-23-inheritance-check): Simplify.

View File

@ -73,6 +73,24 @@
:kind 'single) :kind 'single)
"Expected `package-desc' parsed from new-pkg-1.0.el.") "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) (defvar package-test-data-dir (expand-file-name "data/package" package-test-file-dir)
"Base directory of package test files.") "Base directory of package test files.")
@ -479,6 +497,35 @@ Must called from within a `tar-mode' buffer."
(should (equal archive-contents (should (equal archive-contents
(list 1 package-x-test--single-archive-entry-1-4)))))) (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) (provide 'package-test)
;;; package-test.el ends here ;;; package-test.el ends here