1 ;;; package-test.el --- Tests for the Emacs package system
3 ;; Copyright (C) 2013-2014 Free Software Foundation, Inc.
5 ;; Author: Daniel Hackney <dan@haxney.org>
8 ;; This file is part of GNU Emacs.
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.
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.
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/>.
30 (require 'package-test
)
32 (defvar package-x-test--single-archive-entry-1-3
34 (package-make-ac-desc '(1 3) nil
35 "A single-file package with no dependencies"
37 '((:url .
"http://doodles.au"))))
38 "Expected contents of the archive entry from the \"simple-single\" package.")
40 (defvar package-x-test--single-archive-entry-1-4
42 (package-make-ac-desc '(1 4) nil
43 "A single-file package with no dependencies"
46 "Expected contents of the archive entry from the updated \"simple-single\" package.")
48 (ert-deftest package-x-test-upload-buffer
()
49 "Test creating an \"archive-contents\" file"
50 (with-package-test (:basedir
"data/package"
51 :file
"simple-single-1.3.el"
53 (package-upload-buffer)
54 (should (file-exists-p (expand-file-name "archive-contents"
55 package-archive-upload-base
)))
56 (should (file-exists-p (expand-file-name "simple-single-1.3.el"
57 package-archive-upload-base
)))
58 (should (file-exists-p (expand-file-name "simple-single-readme.txt"
59 package-archive-upload-base
)))
61 (let (archive-contents)
64 (expand-file-name "archive-contents"
65 package-archive-upload-base
))
66 (setq archive-contents
67 (package-read-from-string
68 (buffer-substring (point-min) (point-max)))))
69 (should (equal archive-contents
70 (list 1 package-x-test--single-archive-entry-1-3
))))))
72 (ert-deftest package-x-test-upload-new-version
()
73 "Test uploading a new version of a package"
74 (with-package-test (:basedir
"data/package"
75 :file
"simple-single-1.3.el"
77 (package-upload-buffer)
79 (insert-file-contents "newer-versions/simple-single-1.4.el")
80 (package-upload-buffer))
82 (let (archive-contents)
85 (expand-file-name "archive-contents"
86 package-archive-upload-base
))
87 (setq archive-contents
88 (package-read-from-string
89 (buffer-substring (point-min) (point-max)))))
90 (should (equal archive-contents
91 (list 1 package-x-test--single-archive-entry-1-4
))))))
93 (provide 'package-x-test
)
95 ;;; package-x-test.el ends here