1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (test-hackage)
20 #:use-module (guix import hackage)
21 #:use-module (guix tests)
22 #:use-module (srfi srfi-64)
23 #:use-module (ice-9 match))
28 homepage: http://test.org
30 description: description
34 HTTP >= 4000.2.5 && < 4000.3,
38 ;; Use TABs to indent lines and to separate keys from value.
42 homepage: http://test.org
44 description: description
47 build-depends: HTTP >= 4000.2.5 && < 4000.3,
51 ;; Use indentation with comma as found, e.g., in 'haddock-api'.
55 homepage: http://test.org
57 description: description
61 HTTP >= 4000.2.5 && < 4000.3
66 "(os(darwin) || !(flag(debug))) && flag(cips)")
69 (@@ (guix import hackage) read-cabal))
71 (define eval-cabal-keywords
72 (@@ (guix import hackage) eval-cabal-keywords))
74 (define conditional->sexp-like
75 (@@ (guix import hackage) conditional->sexp-like))
77 (test-begin "hackage")
79 (define (eval-test-with-cabal test-cabal)
81 ((guix import hackage) hackage-fetch
82 (lambda (name-version)
83 (call-with-input-string test-cabal
85 (match (hackage->guix-package "foo")
93 "http://hackage.haskell.org/package/foo/foo-"
99 ('build-system 'haskell-build-system)
102 (("ghc-http" ('unquote 'ghc-http))
103 ("ghc-mtl" ('unquote 'ghc-mtl)))))
104 ('home-page "http://test.org")
105 ('synopsis (? string?))
106 ('description (? string?))
112 (test-assert "hackage->guix-package test 1"
113 (eval-test-with-cabal test-cabal-1))
115 (test-assert "hackage->guix-package test 2"
116 (eval-test-with-cabal test-cabal-2))
118 (test-assert "hackage->guix-package test 3"
119 (eval-test-with-cabal test-cabal-3))
121 (test-assert "conditional->sexp-like"
124 (conditional->sexp-like test-cond-1)
125 '(("debug" . "False")))
126 (('and ('or ('string-match "darwin" ('%current-system)) ('not '#f)) '#t)
134 (exit (= (test-runner-fail-count (test-runner-current)) 0))