aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-discovery)
  #:use-module (guix discovery)
  #:use-module (guix build-system)
  #:use-module (guix utils)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 match))

(define %top-srcdir
  (dirname (search-path %load-path "guix.scm")))

(test-begin "discovery")

(test-assert "scheme-modules"
  (match (map module-name (scheme-modules %top-srcdir "guix/import"))
    ((('guix 'import _ ...) ..1)
     #t)))

(test-assert "scheme-modules recurses in symlinks to directories"
  (call-with-temporary-directory
   (lambda (directory)
     (mkdir (string-append directory "/guix"))
     (symlink (string-append %top-srcdir "/guix/import")
              (string-append directory "/guix/import"))

     ;; DIRECTORY/guix/import is a symlink but we want to make sure
     ;; 'scheme-modules' recurses into it.
     (match (map module-name (scheme-modules directory))
       ((('guix 'import _ ...) ..1)
        #t)))))

(test-equal "scheme-modules, non-existent directory"
  '()
  (scheme-modules "/does/not/exist"))

(test-assert "all-modules"
  (match (map module-name
              (all-modules `((,%top-srcdir . "guix/build-system"))))
    ((('guix 'build-system names) ..1)
     names)))

(test-assert "fold-module-public-variables"
  (let ((modules (all-modules `((,%top-srcdir . "guix/build-system")))))
    (match (fold-module-public-variables (lambda (obj result)
                                           (if (build-system? obj)
                                               (cons obj result)
                                               result))
                                         '()
                                         modules)
      (((? build-system? bs) ..1)
       bs))))

(test-end "discovery")
0'>nls: Update 'sr' translation.Ludovic Courtès 2014-06-17nls: Use xgettext and msgmerge with --no-wrap....Ludovic Courtès 2014-06-17nls: Remove obsolete messages from PO files....Ludovic Courtès 2014-06-14i18n: Move package descriptions from 'guix' to 'guix-packages'....Ludovic Courtès 2014-06-13Separate package description translations from string translations....Ludovic Courtès 2014-06-13Move gettext files to 'po/guix'....Ludovic Courtès 2014-06-03Update 'eo.po'.Ludovic Courtès 2014-04-09Update '.po' files.Ludovic Courtès 2014-02-21ui: Handle SRFI-35 '&message' conditions....Ludovic Courtès 2014-02-18Add 'guix system'....Ludovic Courtès 2014-01-24nar: Add 'restore-file-set', for use by build hooks....Ludovic Courtès 2014-01-15Update 'sr.po'.Ludovic Courtès 2013-12-20daemon: Implement signed archive import/export....Ludovic Courtès 2013-12-10Update '.po' files.Ludovic Courtès 2013-12-04nls: Add Vietnamese translation....Ludovic Courtès 2013-12-04Update 'eo.po'.Ludovic Courtès 2013-11-09nls: Add Serbian translation....Ludovic Courtès 2013-09-29Update 'pt_BR.po'.Ludovic Courtès 2013-09-27Update '.po' files.Ludovic Courtès 2013-09-25Update 'eo.po'.Ludovic Courtès 2013-08-15Update `eo.po'.Ludovic Courtès 2013-07-17Update .po files.Ludovic Courtès 2013-07-15Add `pt_BR' translation.Ludovic Courtès 2013-07-14Update `eo.po'.Ludovic Courtès 2013-07-14Rename (guix web) to (guix http-client)....Ludovic Courtès 2013-07-10Update eo.po.Ludovic Courtès 2013-06-19Update eo.po.Ludovic Courtès 2013-06-19Add `substitute-binary.scm' to POTFILES.in....Ludovic Courtès 2013-05-24nls: Add Esperanto translation....Ludovic Courtès 2013-04-25web: Factorize `http-get' hackery....Ludovic Courtès 2013-04-21Add 'guix hash'....Nikita Karetnikov 2013-04-21ui: Add a 'define-diagnostic' macro....Nikita Karetnikov 2013-02-20Add "guix pull"....Ludovic Courtès 2013-02-16Replace individual scripts with master 'guix' script....Mark H Weaver 2013-01-18distro: Rename (distro) to (gnu packages)....Ludovic Courtès 2013-01-18distro: Change the module name space to (gnu ...)....Ludovic Courtès 2013-01-06Add `guix-gc'....Ludovic Courtès 2013-01-05ui: Factorize bug-report information in `--help'....Ludovic Courtès 2012-11-04distro: Go for one module per package....Ludovic Courtès