summaryrefslogtreecommitdiff
path: root/tests/import
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-09-17 01:10:10 +0200
committerLudovic Courtès <ludo@gnu.org>2025-10-01 11:04:16 +0200
commitfc905a5a6974535ee6cc079b91acaeca047f7ec9 (patch)
treeaaaf0cbd0525810141a4d7af7505f398a761b7f0 /tests/import
parent7a41349bed30d03032ee249d43dc64de5cefdd84 (diff)
import: elpa: Move tests to tests/import/elpa.scm.
* tests/elpa.scm: Move to tests/import/elpa.scm. * Makefile.am: Refresh it. * CODEOWNERS: Refresh it. * etc/teams.scm: Refresh it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests/import')
-rw-r--r--tests/import/elpa.scm135
1 files changed, 135 insertions, 0 deletions
diff --git a/tests/import/elpa.scm b/tests/import/elpa.scm
new file mode 100644
index 00000000000..f563b99df1c
--- /dev/null
+++ b/tests/import/elpa.scm
@@ -0,0 +1,135 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
3;;; Copyright © 2020, 2023 Ludovic Courtès <ludo@gnu.org>
4;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
5;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (test-elpa)
23 #:use-module (guix import elpa)
24 #:use-module (guix upstream)
25 #:use-module ((guix download) #:select (url-fetch))
26 #:use-module (guix tests)
27 #:use-module (guix tests http)
28 #:use-module (srfi srfi-1)
29 #:use-module (srfi srfi-64)
30 #:use-module (ice-9 match)
31 #:use-module (web client))
32
33(define elpa-mock-archive
34 '(1
35 (ace-window .
36 [(0 9 0)
37 ((avy
38 (0 2 0)))
39 "Quickly switch windows." single
40 ((:url . "https://github.com/abo-abo/ace-window")
41 (:keywords "window" "location"))])
42 (auctex .
43 [(11 88 6)
44 nil "Integrated environment for *TeX*" tar
45 ((:url . "http://www.gnu.org/software/auctex/"))])
46 (fake-taxy-magit-section .
47 [(0 12 2)
48 ((emacs
49 (26 3))
50 (magit-section
51 (3 2 1))
52 (taxy
53 (0 10)))
54 "View Taxy structs in a Magit Section buffer" tar
55 ((:url . "https://github.com/alphapapa/taxy.el")
56 (:keywords "lisp"))])))
57
58
59(test-begin "elpa")
60
61(define (eval-test-with-elpa pkg)
62 ;; Set up an HTTP server and use it as a pseudo-proxy so that
63 ;; 'elpa->guix-package' talks to it.
64 (with-http-server `((200 ,(object->string elpa-mock-archive))
65 (200 "This is the description.")
66 (200 "fake tarball contents"))
67 (parameterize ((current-http-proxy (%local-url)))
68 (match (elpa->guix-package pkg #:repo 'gnu/http)
69 (`(package
70 (name "emacs-auctex")
71 (version "11.88.6")
72 (source
73 (origin
74 (method url-fetch)
75 (uri (string-append
76 "http://elpa.gnu.org/packages/auctex-" version ".tar"))
77 (sha256 (base32 ,(? string? hash)))))
78 (build-system emacs-build-system)
79 (home-page "http://www.gnu.org/software/auctex/")
80 (synopsis "Integrated environment for *TeX*")
81 (description "This is the description.")
82 (license license:gpl3+))
83 #t)
84 (x
85 (pk 'fail x #f))))))
86
87(test-assert "elpa->guix-package test 1"
88 (eval-test-with-elpa "auctex"))
89
90(test-equal "package-latest-release"
91 (list '("http://elpa.gnu.org/packages/fake-taxy-magit-section-0.12.2.tar")
92 '("http://elpa.gnu.org/packages/fake-taxy-magit-section-0.12.2.tar.sig")
93 (list (upstream-input
94 (name "magit-section")
95 (downstream-name "emacs-magit-section")
96 (type 'propagated)
97 (min-version "3.2.1")
98 (max-version min-version))
99 (upstream-input
100 (name "taxy")
101 (downstream-name "emacs-taxy")
102 (type 'propagated)
103 (min-version "0.10")
104 (max-version #f))))
105 (with-http-server `((200 ,(object->string elpa-mock-archive)))
106 (parameterize ((current-http-proxy (%local-url)))
107 (define source
108 ;; Note: Use 'http' URLs to the proxy is used.
109 (package-latest-release
110 (dummy-package "emacs-fake-taxy-magit-section"
111 (version "0.0.0")
112 (source (dummy-origin
113 (method url-fetch)
114 (uri "http://elpa.gnu.org/xyz"))))
115 (list %elpa-updater)))
116
117 (list (upstream-source-urls source)
118 (upstream-source-signature-urls source)
119 (upstream-source-inputs source)))))
120
121(test-equal "guix-package->elpa-name: without 'upstream-name' property"
122 "auctex"
123 (guix-package->elpa-name (dummy-package "emacs-auctex")))
124
125(test-equal "guix-package->elpa-name: with 'upstream-name' property"
126 "project"
127 (guix-package->elpa-name
128 (dummy-package "emacs-fake-name"
129 (properties '((upstream-name . "project"))))))
130
131(test-end "elpa")
132
133;; Local Variables:
134;; eval: (put 'with-http-server 'scheme-indent-function 1)
135;; End: