Commit | Line | Data |
---|---|---|
cd903ef7 LC |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
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. | |
10 | ;;; | |
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. | |
15 | ;;; | |
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/>. | |
18 | ||
19 | (define-module (test-discovery) | |
20 | #:use-module (guix discovery) | |
21 | #:use-module (guix build-system) | |
22 | #:use-module (srfi srfi-64) | |
23 | #:use-module (ice-9 match)) | |
24 | ||
25 | (define %top-srcdir | |
26 | (dirname (search-path %load-path "guix.scm"))) | |
27 | ||
28 | (test-begin "discovery") | |
29 | ||
30 | (test-assert "scheme-modules" | |
31 | (match (map module-name (scheme-modules %top-srcdir "guix/import")) | |
32 | ((('guix 'import _ ...) ..1) | |
33 | #t))) | |
34 | ||
35 | (test-assert "all-modules" | |
36 | (match (map module-name | |
37 | (all-modules `((,%top-srcdir . "guix/build-system")))) | |
38 | ((('guix 'build-system names) ..1) | |
39 | names))) | |
40 | ||
41 | (test-assert "fold-module-public-variables" | |
42 | (let ((modules (all-modules `((,%top-srcdir . "guix/build-system"))))) | |
43 | (match (fold-module-public-variables (lambda (obj result) | |
44 | (if (build-system? obj) | |
45 | (cons obj result) | |
46 | result)) | |
47 | '() | |
48 | modules) | |
49 | (((? build-system? bs) ..1) | |
50 | bs)))) | |
51 | ||
52 | (test-end "discovery") |