1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org>
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-snix)
20 #:use-module (guix import snix)
21 #:use-module (srfi srfi-1)
22 #:use-module (srfi srfi-64)
23 #:use-module (ice-9 match))
25 (define %nixpkgs-directory
29 (@@ (guix import snix) factorize-uri))
31 (define-syntax-rule (every? proc lists ...)
32 (not (not (every proc lists ...))))
36 (test-assert "factorize-uri"
38 ((uri version '-> expected)
39 (equal? (factorize-uri uri version)
41 '(("http://example.com/foo.tgz" "1.0"
42 -> "http://example.com/foo.tgz")
43 ("http://example.com/foo-2.8.tgz" "2.8"
44 -> ("http://example.com/foo-" version ".tgz"))
45 ("http://example.com/2.8/foo-2.8.tgz" "2.8"
46 -> ("http://example.com/" version "/foo-" version ".tgz")))))
48 (test-skip (if (and %nixpkgs-directory
49 (file-exists? (string-append %nixpkgs-directory
54 (test-assert "nixpkgs->guix-package"
55 (match (nixpkgs->guix-package %nixpkgs-directory "guile")
58 ('version (? string?))
59 ('source ('origin _ ...))
61 ('inputs ('quasiquote (inputs ...)))
62 ('propagated-inputs ('quasiquote (pinputs ...)))
63 ('home-page (? string?))
64 ('synopsis (? string?))
65 ('description (? string?))
66 ('license (? symbol?)))
67 (and (member '("libffi" ,libffi) inputs)
68 (member '("gmp" ,gmp) pinputs)