]> code.delx.au - gnu-emacs/blob - test/automated/package-test.el
55806454741703cdf5b80bf7d98a1a5020a2b22c
[gnu-emacs] / test / automated / package-test.el
1 ;;; package-test.el --- Tests for the Emacs package system
2
3 ;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
4
5 ;; Author: Daniel Hackney <dan@haxney.org>
6 ;; Version: 1.0
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;; You may want to run this from a separate Emacs instance from your
26 ;; main one, because a bug in the code below could mess with your
27 ;; installed packages.
28
29 ;; Run this in a clean Emacs session using:
30 ;;
31 ;; $ emacs -Q --batch -L . -l package-test.el -l ert -f ert-run-tests-batch-and-exit
32
33 ;;; Code:
34
35 (require 'package)
36 (require 'ert)
37 (require 'cl-lib)
38
39 (setq package-menu-async nil)
40
41 (defvar package-test-user-dir nil
42 "Directory to use for installing packages during testing.")
43
44 (defvar package-test-file-dir (file-name-directory (or load-file-name
45 buffer-file-name))
46 "Directory of the actual \"package-test.el\" file.")
47
48 (defvar simple-single-desc
49 (package-desc-create :name 'simple-single
50 :version '(1 3)
51 :summary "A single-file package with no dependencies"
52 :kind 'single
53 :extras '((:authors ("J. R. Hacker" . "jrh@example.com"))
54 (:maintainer "J. R. Hacker" . "jrh@example.com")
55 (:url . "http://doodles.au")))
56 "Expected `package-desc' parsed from simple-single-1.3.el.")
57
58 (defvar simple-depend-desc
59 (package-desc-create :name 'simple-depend
60 :version '(1 0)
61 :summary "A single-file package with a dependency."
62 :kind 'single
63 :reqs '((simple-single (1 3)))
64 :extras '((:authors ("J. R. Hacker" . "jrh@example.com"))
65 (:maintainer "J. R. Hacker" . "jrh@example.com")))
66 "Expected `package-desc' parsed from simple-depend-1.0.el.")
67
68 (defvar multi-file-desc
69 (package-desc-create :name 'multi-file
70 :version '(0 2 3)
71 :summary "Example of a multi-file tar package"
72 :kind 'tar
73 :extras '((:url . "http://puddles.li")))
74 "Expected `package-desc' from \"multi-file-0.2.3.tar\".")
75
76 (defvar new-pkg-desc
77 (package-desc-create :name 'new-pkg
78 :version '(1 0)
79 :kind 'single)
80 "Expected `package-desc' parsed from new-pkg-1.0.el.")
81
82 (defvar simple-depend-desc-1
83 (package-desc-create :name 'simple-depend-1
84 :version '(1 0)
85 :summary "A single-file package with a dependency."
86 :kind 'single
87 :reqs '((simple-depend (1 0))
88 (multi-file (0 1))))
89 "`package-desc' used for testing dependencies.")
90
91 (defvar simple-depend-desc-2
92 (package-desc-create :name 'simple-depend-2
93 :version '(1 0)
94 :summary "A single-file package with a dependency."
95 :kind 'single
96 :reqs '((simple-depend-1 (1 0))
97 (multi-file (0 1))))
98 "`package-desc' used for testing dependencies.")
99
100 (defvar package-test-data-dir (expand-file-name "data/package" package-test-file-dir)
101 "Base directory of package test files.")
102
103 (defvar package-test-fake-contents-file
104 (expand-file-name "archive-contents" package-test-data-dir)
105 "Path to a static copy of \"archive-contents\".")
106
107 (cl-defmacro with-package-test ((&optional &key file
108 basedir
109 install
110 location
111 update-news
112 upload-base)
113 &rest body)
114 "Set up temporary locations and variables for testing."
115 (declare (indent 1))
116 `(let* ((package-test-user-dir (make-temp-file "pkg-test-user-dir-" t))
117 (process-environment (cons (format "HOME=%s" package-test-user-dir)
118 process-environment))
119 (package-user-dir package-test-user-dir)
120 (package-archives `(("gnu" . ,(or ,location package-test-data-dir))))
121 (default-directory package-test-file-dir)
122 abbreviated-home-dir
123 package--initialized
124 package-alist
125 ,@(if update-news
126 '(package-update-news-on-upload t)
127 (list (cl-gensym)))
128 ,@(if upload-base
129 '((package-test-archive-upload-base (make-temp-file "pkg-archive-base-" t))
130 (package-archive-upload-base package-test-archive-upload-base))
131 (list (cl-gensym)))) ;; Dummy value so `let' doesn't try to bind nil
132 (let ((buf (get-buffer "*Packages*")))
133 (when (buffer-live-p buf)
134 (kill-buffer buf)))
135 (unwind-protect
136 (progn
137 ,(if basedir `(cd ,basedir))
138 (unless (file-directory-p package-user-dir)
139 (mkdir package-user-dir))
140 (cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest r) t))
141 ((symbol-function 'y-or-n-p) (lambda (&rest r) t)))
142 ,@(when install
143 `((package-initialize)
144 (package-refresh-contents)
145 (mapc 'package-install ,install)))
146 (with-temp-buffer
147 ,(if file
148 `(insert-file-contents ,file))
149 ,@body)))
150
151 (when (file-directory-p package-test-user-dir)
152 (delete-directory package-test-user-dir t))
153
154 (when (and (boundp 'package-test-archive-upload-base)
155 (file-directory-p package-test-archive-upload-base))
156 (delete-directory package-test-archive-upload-base t)))))
157
158 (defmacro with-fake-help-buffer (&rest body)
159 "Execute BODY in a temp buffer which is treated as the \"*Help*\" buffer."
160 `(with-temp-buffer
161 (help-mode)
162 ;; Trick `help-buffer' into using the temp buffer.
163 (let ((help-xref-following t))
164 ,@body)))
165
166 (defun package-test-strip-version (dir)
167 (replace-regexp-in-string "-pkg\\.el\\'" "" (package--description-file dir)))
168
169 (defun package-test-suffix-matches (base suffix-list)
170 "Return file names matching BASE concatenated with each item in SUFFIX-LIST"
171 (cl-mapcan
172 '(lambda (item) (file-expand-wildcards (concat base item)))
173 suffix-list))
174
175 (defvar tar-parse-info)
176 (declare-function tar-header-name "tar-mode" (cl-x) t) ; defstruct
177
178 (defun package-test-search-tar-file (filename)
179 "Search the current buffer's `tar-parse-info' variable for FILENAME.
180
181 Must called from within a `tar-mode' buffer."
182 (cl-dolist (header tar-parse-info)
183 (let ((tar-name (tar-header-name header)))
184 (when (string= tar-name filename)
185 (cl-return t)))))
186
187 (defun package-test-desc-version-string (desc)
188 "Return the package version as a string."
189 (package-version-join (package-desc-version desc)))
190
191 (ert-deftest package-test-desc-from-buffer ()
192 "Parse an elisp buffer to get a `package-desc' object."
193 (with-package-test (:basedir "data/package" :file "simple-single-1.3.el")
194 (should (equal (package-buffer-info) simple-single-desc)))
195 (with-package-test (:basedir "data/package" :file "simple-depend-1.0.el")
196 (should (equal (package-buffer-info) simple-depend-desc)))
197 (with-package-test (:basedir "data/package"
198 :file "multi-file-0.2.3.tar")
199 (tar-mode)
200 (should (equal (package-tar-file-info) multi-file-desc))))
201
202 (ert-deftest package-test-install-single ()
203 "Install a single file without using an archive."
204 (with-package-test (:basedir "data/package" :file "simple-single-1.3.el")
205 (should (package-install-from-buffer))
206 (package-initialize)
207 (should (package-installed-p 'simple-single))
208 ;; Check if we properly report an "already installed".
209 (package-install 'simple-single)
210 (with-current-buffer "*Messages*"
211 (should (string-match "^[`‘']simple-single[’'] is already installed\n?\\'"
212 (buffer-string))))
213 (should (package-installed-p 'simple-single))
214 (let* ((simple-pkg-dir (file-name-as-directory
215 (expand-file-name
216 "simple-single-1.3"
217 package-test-user-dir)))
218 (autoloads-file (expand-file-name "simple-single-autoloads.el"
219 simple-pkg-dir)))
220 (should (file-directory-p simple-pkg-dir))
221 (with-temp-buffer
222 (insert-file-contents (expand-file-name "simple-single-pkg.el"
223 simple-pkg-dir))
224 (should (string= (buffer-string)
225 (concat ";;; -*- no-byte-compile: t -*-\n"
226 "(define-package \"simple-single\" \"1.3\" "
227 "\"A single-file package "
228 "with no dependencies\" 'nil "
229 ":authors '((\"J. R. Hacker\" . \"jrh@example.com\")) "
230 ":maintainer '(\"J. R. Hacker\" . \"jrh@example.com\") "
231 ":url \"http://doodles.au\""
232 ")\n"))))
233 (should (file-exists-p autoloads-file))
234 (should-not (get-file-buffer autoloads-file)))))
235
236 (ert-deftest package-test-install-dependency ()
237 "Install a package which includes a dependency."
238 (with-package-test ()
239 (package-initialize)
240 (package-refresh-contents)
241 (package-install 'simple-depend)
242 (should (package-installed-p 'simple-single))
243 (should (package-installed-p 'simple-depend))))
244
245 (ert-deftest package-test-macro-compilation ()
246 "Install a package which includes a dependency."
247 (with-package-test (:basedir "data/package")
248 (package-install-file (expand-file-name "macro-problem-package-1.0/"))
249 (require 'macro-problem)
250 ;; `macro-problem-func' uses a macro from `macro-aux'.
251 (should (equal (macro-problem-func) '(progn a b)))
252 (package-install-file (expand-file-name "macro-problem-package-2.0/"))
253 ;; After upgrading, `macro-problem-func' depends on a new version
254 ;; of the macro from `macro-aux'.
255 (should (equal (macro-problem-func) '(1 b)))
256 ;; `macro-problem-10-and-90' depends on an entirely new macro from `macro-aux'.
257 (should (equal (macro-problem-10-and-90) '(10 90)))))
258
259 (ert-deftest package-test-install-two-dependencies ()
260 "Install a package which includes a dependency."
261 (with-package-test ()
262 (package-initialize)
263 (package-refresh-contents)
264 (package-install 'simple-two-depend)
265 (should (package-installed-p 'simple-single))
266 (should (package-installed-p 'simple-depend))
267 (should (package-installed-p 'simple-two-depend))))
268
269 (ert-deftest package-test-refresh-contents ()
270 "Parse an \"archive-contents\" file."
271 (with-package-test ()
272 (package-initialize)
273 (package-refresh-contents)
274 (should (eq 4 (length package-archive-contents)))))
275
276 (ert-deftest package-test-install-single-from-archive ()
277 "Install a single package from a package archive."
278 (with-package-test ()
279 (package-initialize)
280 (package-refresh-contents)
281 (package-install 'simple-single)))
282
283 (ert-deftest package-test-install-prioritized ()
284 "Install a lower version from a higher-prioritized archive."
285 (with-package-test ()
286 (let* ((newer-version (expand-file-name "data/package/newer-versions"
287 package-test-file-dir))
288 (package-archives `(("older" . ,package-test-data-dir)
289 ("newer" . ,newer-version)))
290 (package-archive-priorities '(("older" . 100))))
291
292 (package-initialize)
293 (package-refresh-contents)
294 (package-install 'simple-single)
295
296 (let ((installed (cadr (assq 'simple-single package-alist))))
297 (should (version-list-= '(1 3)
298 (package-desc-version installed)))))))
299
300 (ert-deftest package-test-install-multifile ()
301 "Check properties of the installed multi-file package."
302 (with-package-test (:basedir "data/package" :install '(multi-file))
303 (let ((autoload-file
304 (expand-file-name "multi-file-autoloads.el"
305 (expand-file-name
306 "multi-file-0.2.3"
307 package-test-user-dir)))
308 (installed-files '("dir" "multi-file.info" "multi-file-sub.elc"
309 "multi-file-autoloads.el" "multi-file.elc"))
310 (autoload-forms '("^(defvar multi-file-custom-var"
311 "^(custom-autoload 'multi-file-custom-var"
312 "^(autoload 'multi-file-mode"))
313 (pkg-dir (file-name-as-directory
314 (expand-file-name
315 "multi-file-0.2.3"
316 package-test-user-dir))))
317 (package-refresh-contents)
318 (should (package-installed-p 'multi-file))
319 (with-temp-buffer
320 (insert-file-contents-literally autoload-file)
321 (dolist (fn installed-files)
322 (should (file-exists-p (expand-file-name fn pkg-dir))))
323 (dolist (re autoload-forms)
324 (goto-char (point-min))
325 (should (re-search-forward re nil t)))))))
326
327 (ert-deftest package-test-update-listing ()
328 "Ensure installed package status is updated."
329 (with-package-test ()
330 (let ((buf (package-list-packages)))
331 (search-forward-regexp "^ +simple-single")
332 (package-menu-mark-install)
333 (package-menu-execute)
334 (run-hooks 'post-command-hook)
335 (should (package-installed-p 'simple-single))
336 (switch-to-buffer "*Packages*")
337 (goto-char (point-min))
338 (should (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+installed" nil t))
339 (goto-char (point-min))
340 (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t))
341 (kill-buffer buf))))
342
343 (ert-deftest package-test-update-archives ()
344 "Test updating package archives."
345 (with-package-test ()
346 (let ((buf (package-list-packages)))
347 (package-menu-refresh)
348 (search-forward-regexp "^ +simple-single")
349 (package-menu-mark-install)
350 (package-menu-execute)
351 (should (package-installed-p 'simple-single))
352 (let ((package-test-data-dir
353 (expand-file-name "data/package/newer-versions" package-test-file-dir)))
354 (setq package-archives `(("gnu" . ,package-test-data-dir)))
355 (package-menu-refresh)
356
357 ;; New version should be available and old version should be installed
358 (goto-char (point-min))
359 (should (re-search-forward "^\\s-+simple-single\\s-+1.4\\s-+available" nil t))
360 (should (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+installed" nil t))
361
362 (goto-char (point-min))
363 (should (re-search-forward "^\\s-+new-pkg\\s-+1.0\\s-+\\(available\\|new\\)" nil t))
364
365 (package-menu-mark-upgrades)
366 (package-menu-execute)
367 (package-menu-refresh)
368 (should (package-installed-p 'simple-single '(1 4)))))))
369
370 (ert-deftest package-test-update-archives-async ()
371 "Test updating package archives asynchronously."
372 (skip-unless (executable-find "python2"))
373 ;; For some reason this test doesn't work reliably on hydra.nixos.org.
374 (skip-unless (not (getenv "NIX_STORE")))
375 (with-package-test (:basedir
376 package-test-data-dir
377 :location "http://0.0.0.0:8000/")
378 (let* ((package-menu-async t)
379 (process (start-process
380 "package-server" "package-server-buffer"
381 (executable-find "python2")
382 (expand-file-name "package-test-server.py"))))
383 (unwind-protect
384 (progn
385 (list-packages)
386 (should package--downloads-in-progress)
387 (should mode-line-process)
388 (should-not
389 (with-timeout (10 'timeout)
390 (while package--downloads-in-progress
391 (accept-process-output nil 1))
392 nil))
393 ;; If the server process died, there's some non-Emacs problem.
394 ;; Eg maybe the port was already in use.
395 (skip-unless (process-live-p process))
396 (goto-char (point-min))
397 (should
398 (search-forward-regexp "^ +simple-single" nil t)))
399 (if (process-live-p process) (kill-process process))))))
400
401 (ert-deftest package-test-describe-package ()
402 "Test displaying help for a package."
403
404 (require 'finder-inf)
405 ;; Built-in
406 (with-fake-help-buffer
407 (describe-package '5x5)
408 (goto-char (point-min))
409 (should (search-forward "5x5 is a built-in package." nil t))
410 ;; Don't assume the descriptions are in any particular order.
411 (save-excursion (should (search-forward "Status: Built-in." nil t)))
412 (save-excursion (should (search-forward "Summary: simple little puzzle game" nil t)))
413 (should (search-forward "The aim of 5x5" nil t)))
414
415 ;; Installed
416 (with-package-test ()
417 (package-initialize)
418 (package-refresh-contents)
419 (package-install 'simple-single)
420 (with-fake-help-buffer
421 (describe-package 'simple-single)
422 (goto-char (point-min))
423 (should (search-forward "simple-single is an installed package." nil t))
424 (save-excursion (should (re-search-forward "Status: Installed in ['`‘]simple-single-1.3/['’] (unsigned)." nil t)))
425 (save-excursion (should (search-forward "Version: 1.3" nil t)))
426 (save-excursion (should (search-forward "Summary: A single-file package with no dependencies" nil t)))
427 (save-excursion (should (search-forward "Homepage: http://doodles.au" nil t)))
428 (save-excursion (should (re-search-forward "Keywords: \\[?frobnicate\\]?" nil t)))
429 ;; No description, though. Because at this point we don't know
430 ;; what archive the package originated from, and we don't have
431 ;; its readme file saved.
432 )))
433
434 (ert-deftest package-test-describe-non-installed-package ()
435 "Test displaying of the readme for non-installed package."
436
437 (with-package-test ()
438 (package-initialize)
439 (package-refresh-contents)
440 (with-fake-help-buffer
441 (describe-package 'simple-single)
442 (goto-char (point-min))
443 (should (search-forward "Homepage: http://doodles.au" nil t))
444 (should (search-forward "This package provides a minor mode to frobnicate"
445 nil t)))))
446
447 (ert-deftest package-test-describe-non-installed-multi-file-package ()
448 "Test displaying of the readme for non-installed multi-file package."
449
450 (with-package-test ()
451 (package-initialize)
452 (package-refresh-contents)
453 (with-fake-help-buffer
454 (describe-package 'multi-file)
455 (goto-char (point-min))
456 (should (search-forward "Homepage: http://puddles.li" nil t))
457 (should (search-forward "This is a bare-bones readme file for the multi-file"
458 nil t)))))
459
460 (ert-deftest package-test-signed ()
461 "Test verifying package signature."
462 (skip-unless (ignore-errors
463 (let ((homedir (make-temp-file "package-test" t)))
464 (unwind-protect
465 (let ((process-environment
466 (cons (format "HOME=%s" homedir)
467 process-environment)))
468 (epg-check-configuration (epg-configuration))
469 (epg-find-configuration 'OpenPGP))
470 (delete-directory homedir t)))))
471 (let* ((keyring (expand-file-name "key.pub" package-test-data-dir))
472 (package-test-data-dir
473 (expand-file-name "data/package/signed" package-test-file-dir)))
474 (with-package-test ()
475 (package-initialize)
476 (package-import-keyring keyring)
477 (package-refresh-contents)
478 (should (package-install 'signed-good))
479 (should-error (package-install 'signed-bad))
480 ;; Check if the installed package status is updated.
481 (let ((buf (package-list-packages)))
482 (package-menu-refresh)
483 (should (re-search-forward
484 "^\\s-+signed-good\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-"
485 nil t))
486 (should (string-equal (match-string-no-properties 1) "1.0"))
487 (should (string-equal (match-string-no-properties 2) "installed")))
488 ;; Check if the package description is updated.
489 (with-fake-help-buffer
490 (describe-package 'signed-good)
491 (goto-char (point-min))
492 (should (re-search-forward "signed-good is an? \\(\\S-+\\) package." nil t))
493 (should (string-equal (match-string-no-properties 1) "installed"))
494 (should (re-search-forward
495 "Status: Installed in ['`‘]signed-good-1.0/['’]."
496 nil t))))))
497
498
499 \f
500 ;;; Tests for package-x features.
501
502 (require 'package-x)
503
504 (defvar package-x-test--single-archive-entry-1-3
505 (cons 'simple-single
506 (package-make-ac-desc '(1 3) nil
507 "A single-file package with no dependencies"
508 'single
509 '((:authors ("J. R. Hacker" . "jrh@example.com"))
510 (:maintainer "J. R. Hacker" . "jrh@example.com")
511 (:url . "http://doodles.au"))))
512 "Expected contents of the archive entry from the \"simple-single\" package.")
513
514 (defvar package-x-test--single-archive-entry-1-4
515 (cons 'simple-single
516 (package-make-ac-desc '(1 4) nil
517 "A single-file package with no dependencies"
518 'single
519 '((:authors ("J. R. Hacker" . "jrh@example.com"))
520 (:maintainer "J. R. Hacker" . "jrh@example.com"))))
521 "Expected contents of the archive entry from the updated \"simple-single\" package.")
522
523 (ert-deftest package-x-test-upload-buffer ()
524 "Test creating an \"archive-contents\" file"
525 (with-package-test (:basedir "data/package"
526 :file "simple-single-1.3.el"
527 :upload-base t)
528 (package-upload-buffer)
529 (should (file-exists-p (expand-file-name "archive-contents"
530 package-archive-upload-base)))
531 (should (file-exists-p (expand-file-name "simple-single-1.3.el"
532 package-archive-upload-base)))
533 (should (file-exists-p (expand-file-name "simple-single-readme.txt"
534 package-archive-upload-base)))
535
536 (let (archive-contents)
537 (with-temp-buffer
538 (insert-file-contents
539 (expand-file-name "archive-contents"
540 package-archive-upload-base))
541 (setq archive-contents
542 (package-read-from-string
543 (buffer-substring (point-min) (point-max)))))
544 (should (equal archive-contents
545 (list 1 package-x-test--single-archive-entry-1-3))))))
546
547 (ert-deftest package-x-test-upload-new-version ()
548 "Test uploading a new version of a package"
549 (with-package-test (:basedir "data/package"
550 :file "simple-single-1.3.el"
551 :upload-base t)
552 (package-upload-buffer)
553 (with-temp-buffer
554 (insert-file-contents "newer-versions/simple-single-1.4.el")
555 (package-upload-buffer))
556
557 (let (archive-contents)
558 (with-temp-buffer
559 (insert-file-contents
560 (expand-file-name "archive-contents"
561 package-archive-upload-base))
562 (setq archive-contents
563 (package-read-from-string
564 (buffer-substring (point-min) (point-max)))))
565 (should (equal archive-contents
566 (list 1 package-x-test--single-archive-entry-1-4))))))
567
568 (ert-deftest package-test-get-deps ()
569 "Test `package--get-deps' with complex structures."
570 (let ((package-alist
571 (mapcar (lambda (p) (list (package-desc-name p) p))
572 (list simple-single-desc
573 simple-depend-desc
574 multi-file-desc
575 new-pkg-desc
576 simple-depend-desc-1
577 simple-depend-desc-2))))
578 (should
579 (equal (package--get-deps 'simple-depend)
580 '(simple-single)))
581 (should
582 (equal (package--get-deps 'simple-depend 'indirect)
583 nil))
584 (should
585 (equal (package--get-deps 'simple-depend 'direct)
586 '(simple-single)))
587 (should
588 (equal (package--get-deps 'simple-depend-2)
589 '(simple-depend-1 multi-file simple-depend simple-single)))
590 (should
591 (equal (package--get-deps 'simple-depend-2 'indirect)
592 '(simple-depend multi-file simple-single)))
593 (should
594 (equal (package--get-deps 'simple-depend-2 'direct)
595 '(simple-depend-1 multi-file)))))
596
597 (ert-deftest package-test-sort-by-dependence ()
598 "Test `package--sort-by-dependence' with complex structures."
599 (let ((package-alist
600 (mapcar (lambda (p) (list (package-desc-name p) p))
601 (list simple-single-desc
602 simple-depend-desc
603 multi-file-desc
604 new-pkg-desc
605 simple-depend-desc-1
606 simple-depend-desc-2)))
607 (delete-list
608 (list simple-single-desc
609 simple-depend-desc
610 multi-file-desc
611 new-pkg-desc
612 simple-depend-desc-1
613 simple-depend-desc-2)))
614 (should
615 (equal (package--sort-by-dependence delete-list)
616 (list simple-depend-desc-2 simple-depend-desc-1 new-pkg-desc
617 multi-file-desc simple-depend-desc simple-single-desc)))
618 (should
619 (equal (package--sort-by-dependence (reverse delete-list))
620 (list new-pkg-desc simple-depend-desc-2 simple-depend-desc-1
621 multi-file-desc simple-depend-desc simple-single-desc)))))
622
623 (provide 'package-test)
624
625 ;;; package-test.el ends here