1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 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 ((guix utils) #:select (%nixpkgs-directory))
22 #:use-module (srfi srfi-1)
23 #:use-module (srfi srfi-64)
24 #:use-module (ice-9 match))
27 (@@ (guix import snix) factorize-uri))
29 (define-syntax-rule (every? proc lists ...)
30 (not (not (every proc lists ...))))
34 (test-assert "factorize-uri"
36 ((uri version '-> expected)
37 (equal? (factorize-uri uri version)
39 '(("http://example.com/foo.tgz" "1.0"
40 -> "http://example.com/foo.tgz")
41 ("http://example.com/foo-2.8.tgz" "2.8"
42 -> ("http://example.com/foo-" version ".tgz"))
43 ("http://example.com/2.8/foo-2.8.tgz" "2.8"
44 -> ("http://example.com/" version "/foo-" version ".tgz")))))
46 (test-skip (if (and (%nixpkgs-directory)
47 (file-exists? (string-append (%nixpkgs-directory)
52 (test-assert "nixpkgs->guix-package"
53 (match (nixpkgs->guix-package (%nixpkgs-directory) "guile")
56 ('version (? string?))
57 ('source ('origin _ ...))
59 ('inputs ('quasiquote (inputs ...)))
60 ('propagated-inputs ('quasiquote (pinputs ...)))
61 ('home-page (? string?))
62 ('synopsis (? string?))
63 ('description (? string?))
64 ('license (? symbol?)))
65 (and (member '("libffi" ,libffi) inputs)
66 (member '("gmp" ,gmp) pinputs)
74 (exit (= (test-runner-fail-count (test-runner-current)) 0))