1 ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
2 ;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of Guix.
6 ;;; 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 ;;; 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 Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (test-packages)
21 #:use-module (guix store)
22 #:use-module (guix utils)
23 #:use-module (guix derivations)
24 #:use-module (guix packages)
26 #:use-module (distro base)
27 #:use-module (srfi srfi-26)
28 #:use-module (srfi srfi-64)
29 #:use-module (ice-9 match))
31 ;; Test the high-level packaging layer.
34 (false-if-exception (open-connection)))
36 (test-begin "packages")
38 (test-skip (if (not %store) 1 0))
40 (test-assert "GNU Hello"
42 (or (location? (package-location hello))
43 (not (package-location hello)))
44 (let* ((drv (package-derivation %store hello))
45 (out (derivation-path->output-path drv)))
46 (and (build-derivations %store (list drv))
47 (file-exists? (string-append out "/bin/hello"))))))
49 (test-assert "find-packages-by-name"
50 (match (find-packages-by-name "hello")
51 (((? (cut eq? hello <>))) #t)
52 (wrong (pk 'find-packages-by-name wrong #f))))
54 (test-assert "find-packages-by-name with version"
55 (match (find-packages-by-name "hello" (package-version hello))
56 (((? (cut eq? hello <>))) #t)
57 (wrong (pk 'find-packages-by-name wrong #f))))
62 (exit (= (test-runner-fail-count (test-runner-current)) 0))
65 ;;; eval: (put 'test-assert 'scheme-indent-function 1)