| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 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 | |
| 63 | |
| 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 | |
| 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 | |
| 134 | |
| 135 | |