aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2015-01-28 00:09:39 -0300
committerFabián Ezequiel Gallina2015-01-28 00:09:39 -0300
commit8e9166c92c97e7c2041eecee4e00d412a1eca1be (patch)
tree41dc296808281e0883fcc3f70b4323fbad65b69c /test/automated
parentbe2d23e58721b7acc68c0ea654a38e5109df2aa2 (diff)
parenta012c7bbca887c3da837ce3d7ec01be697cffe64 (diff)
downloademacs-8e9166c92c97e7c2041eecee4e00d412a1eca1be.tar.gz
emacs-8e9166c92c97e7c2041eecee4e00d412a1eca1be.zip
Merge from origin/emacs-24
a012c7b Fix copyright years by hand 732fd4c Update copyright year to 2015 Conflicts: INSTALL.REPO admin/notes/lel-TODO doc/man/grep-changelog.1 doc/misc/eww.texi etc/CONTRIBUTE etc/GNU etc/NEWS etc/refcards/emacsver.tex etc/refcards/ru-refcard.tex lib-src/grep-changelog lib-src/test-distrib.c lib/alloca.in.h lib/binary-io.h lib/c-ctype.h lib/c-strcasecmp.c lib/c-strncasecmp.c lib/careadlinkat.c lib/close-stream.c lib/dosname.h lib/dup2.c lib/filemode.h lib/fpending.c lib/fpending.h lib/getgroups.c lib/getloadavg.c lib/getopt.in.h lib/getopt1.c lib/getopt_int.h lib/gettext.h lib/gettime.c lib/gettimeofday.c lib/group-member.c lib/md5.c lib/md5.h lib/memrchr.c lib/sha1.c lib/sig2str.c lib/stdarg.in.h lib/stdbool.in.h lib/stdlib.in.h lib/strftime.c lib/strtoimax.c lib/strtol.c lib/strtoll.c lib/strtoull.c lib/tempname.c lib/time_r.c lib/unsetenv.c lib/xalloc-oversized.h lisp/gnus/gnus-setup.el lisp/progmodes/cap-words.el lisp/w32-common-fns.el m4/alloca.m4 m4/dup2.m4 m4/filemode.m4 m4/getgroups.m4 m4/getloadavg.m4 m4/gettime.m4 m4/gettimeofday.m4 m4/gnulib-common.m4 m4/group-member.m4 m4/manywarnings.m4 m4/memrchr.m4 m4/mktime.m4 m4/pathmax.m4 m4/pthread_sigmask.m4 m4/sig2str.m4 m4/ssize_t.m4 m4/st_dm_mode.m4 m4/stat-time.m4 m4/stdarg.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdio_h.m4 m4/strftime.m4 m4/strtoimax.m4 m4/strtoll.m4 m4/strtoull.m4 m4/strtoumax.m4 m4/time_h.m4 m4/timer_time.m4 m4/timespec.m4 m4/unistd_h.m4 m4/utimbuf.m4 nextstep/README nt/addsection.c src/insdel.c src/w32heap.c test/automated/package-x-test.el
Diffstat (limited to 'test/automated')
-rw-r--r--test/automated/package-x-test.el110
1 files changed, 110 insertions, 0 deletions
diff --git a/test/automated/package-x-test.el b/test/automated/package-x-test.el
new file mode 100644
index 00000000000..70c9d96fde8
--- /dev/null
+++ b/test/automated/package-x-test.el
@@ -0,0 +1,110 @@
1;;; package-test.el --- Tests for the Emacs package system
2
3;; Copyright (C) 2013-2015 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-x-test.el -f ert-run-tests-batch-and-exit
32
33;;; Code:
34
35(require 'package-x)
36(require 'ert)
37(require 'cl-lib)
38(eval-when-compile (require 'package-test))
39
40;; package-test is not normally in `load-path', so temporarily set
41;; `load-path' to contain the current directory.
42(let ((load-path (append (list (file-name-directory (or load-file-name
43 buffer-file-name)))
44 load-path)))
45 (require 'package-test))
46
47(defvar package-x-test--single-archive-entry-1-3
48 (cons 'simple-single
49 (package-make-ac-desc '(1 3) nil
50 "A single-file package with no dependencies"
51 'single
52 '((:url . "http://doodles.au"))))
53 "Expected contents of the archive entry from the \"simple-single\" package.")
54
55(defvar package-x-test--single-archive-entry-1-4
56 (cons 'simple-single
57 (package-make-ac-desc '(1 4) nil
58 "A single-file package with no dependencies"
59 'single
60 nil))
61 "Expected contents of the archive entry from the updated \"simple-single\" package.")
62
63(ert-deftest package-x-test-upload-buffer ()
64 "Test creating an \"archive-contents\" file"
65 (with-package-test (:basedir "data/package"
66 :file "simple-single-1.3.el"
67 :upload-base t)
68 (package-upload-buffer)
69 (should (file-exists-p (expand-file-name "archive-contents"
70 package-archive-upload-base)))
71 (should (file-exists-p (expand-file-name "simple-single-1.3.el"
72 package-archive-upload-base)))
73 (should (file-exists-p (expand-file-name "simple-single-readme.txt"
74 package-archive-upload-base)))
75
76 (let (archive-contents)
77 (with-temp-buffer
78 (insert-file-contents
79 (expand-file-name "archive-contents"
80 package-archive-upload-base))
81 (setq archive-contents
82 (package-read-from-string
83 (buffer-substring (point-min) (point-max)))))
84 (should (equal archive-contents
85 (list 1 package-x-test--single-archive-entry-1-3))))))
86
87(ert-deftest package-x-test-upload-new-version ()
88 "Test uploading a new version of a package"
89 (with-package-test (:basedir "data/package"
90 :file "simple-single-1.3.el"
91 :upload-base t)
92 (package-upload-buffer)
93 (with-temp-buffer
94 (insert-file-contents "newer-versions/simple-single-1.4.el")
95 (package-upload-buffer))
96
97 (let (archive-contents)
98 (with-temp-buffer
99 (insert-file-contents
100 (expand-file-name "archive-contents"
101 package-archive-upload-base))
102 (setq archive-contents
103 (package-read-from-string
104 (buffer-substring (point-min) (point-max)))))
105 (should (equal archive-contents
106 (list 1 package-x-test--single-archive-entry-1-4))))))
107
108(provide 'package-x-test)
109
110;;; package-x-test.el ends here