1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
3 ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
20 (define-module (test-elpa)
21 #:use-module (guix import elpa)
22 #:use-module (guix tests http)
23 #:use-module (srfi srfi-1)
24 #:use-module (srfi srfi-64)
25 #:use-module (ice-9 match)
26 #:use-module (web client))
28 (define elpa-mock-archive
34 "Quickly switch windows." single
35 ((:url . "https://github.com/abo-abo/ace-window")
36 (:keywords "window" "location"))])
39 nil "Integrated environment for *TeX*" tar
40 ((:url . "http://www.gnu.org/software/auctex/"))])))
42 ;; Avoid collisions with other tests.
43 (%http-server-port 10300)
47 (define (eval-test-with-elpa pkg)
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)
56 ('name "emacs-auctex")
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+))
73 (test-assert "elpa->guix-package test 1"
74 (eval-test-with-elpa "auctex"))
79 ;; eval: (put 'with-http-server 'scheme-indent-function 1)