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