Commit | Line | Data |
---|---|---|
7f74a931 FB |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> | |
9d6c6cb2 | 3 | ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org> |
bea3b177 | 4 | ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> |
7f74a931 FB |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | (define-module (test-elpa) | |
22 | #:use-module (guix import elpa) | |
9d6c6cb2 | 23 | #:use-module (guix tests http) |
7f74a931 FB |
24 | #:use-module (srfi srfi-1) |
25 | #:use-module (srfi srfi-64) | |
9d6c6cb2 LC |
26 | #:use-module (ice-9 match) |
27 | #:use-module (web client)) | |
7f74a931 FB |
28 | |
29 | (define elpa-mock-archive | |
30 | '(1 | |
31 | (ace-window . | |
32 | [(0 9 0) | |
33 | ((avy | |
34 | (0 2 0))) | |
35 | "Quickly switch windows." single | |
36 | ((:url . "https://github.com/abo-abo/ace-window") | |
37 | (:keywords "window" "location"))]) | |
38 | (auctex . | |
39 | [(11 88 6) | |
40 | nil "Integrated environment for *TeX*" tar | |
41 | ((:url . "http://www.gnu.org/software/auctex/"))]))) | |
42 | ||
7f74a931 FB |
43 | (test-begin "elpa") |
44 | ||
45 | (define (eval-test-with-elpa pkg) | |
9d6c6cb2 LC |
46 | ;; Set up an HTTP server and use it as a pseudo-proxy so that |
47 | ;; 'elpa->guix-package' talks to it. | |
48 | (with-http-server `((200 ,(object->string elpa-mock-archive)) | |
49 | (200 "This is the description.") | |
50 | (200 "fake tarball contents")) | |
51 | (parameterize ((current-http-proxy (%local-url))) | |
bea3b177 | 52 | (match (elpa->guix-package pkg #:repo 'gnu/http) |
9d6c6cb2 LC |
53 | (('package |
54 | ('name "emacs-auctex") | |
55 | ('version "11.88.6") | |
56 | ('source | |
57 | ('origin | |
58 | ('method 'url-fetch) | |
59 | ('uri ('string-append | |
60 | "http://elpa.gnu.org/packages/auctex-" 'version ".tar")) | |
61 | ('sha256 ('base32 (? string? hash))))) | |
62 | ('build-system 'emacs-build-system) | |
63 | ('home-page "http://www.gnu.org/software/auctex/") | |
64 | ('synopsis "Integrated environment for *TeX*") | |
65 | ('description "This is the description.") | |
66 | ('license 'license:gpl3+)) | |
67 | #t) | |
68 | (x | |
69 | (pk 'fail x #f)))))) | |
7f74a931 FB |
70 | |
71 | (test-assert "elpa->guix-package test 1" | |
72 | (eval-test-with-elpa "auctex")) | |
73 | ||
74 | (test-end "elpa") | |
9d6c6cb2 LC |
75 | |
76 | ;; Local Variables: | |
77 | ;; eval: (put 'with-http-server 'scheme-indent-function 1) | |
78 | ;; End: |