aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016-2017, 2024 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-modules)
  #:use-module (guix modules)
  #:use-module ((guix build-system gnu) #:select (%default-gnu-imported-modules))
  #:use-module ((guix utils) #:select (call-with-temporary-directory))
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-64))

(test-begin "modules")

(test-assert "closure of (guix build gnu-build-system)"
  (lset= equal?
         (live-module-closure '((guix build gnu-build-system)))
         (source-module-closure '((guix build gnu-build-system)))
         %default-gnu-imported-modules
         (source-module-closure %default-gnu-imported-modules)
         (live-module-closure %default-gnu-imported-modules)))

(test-assert "closure of (gnu build install)"
  (lset= equal?
         (live-module-closure '((gnu build install)))
         (source-module-closure '((gnu build install)))))

(test-assert "closure of (gnu build image)"
  (lset= equal?
         (live-module-closure '((gnu build image)))
         (source-module-closure '((gnu build image)))))

(test-equal "&missing-dependency-error"
  '(something that does not exist)
  (call-with-temporary-directory
   (lambda (directory)
     (call-with-output-file (string-append directory "/foobar.scm")
       (lambda (port)
         (write '(define-module (foobar)
                   #:use-module (something that does not exist))
                port)))

     (call-with-output-file (string-append directory "/baz.scm")
       (lambda (port)
         (write '(define-module (baz)
                   #:use-module (foobar))
                port)))

     (guard (c ((missing-dependency-error? c)
                (missing-dependency-module c)))
       (source-module-closure '((baz)) (list directory)
                              #:select? (const #t))))))

(test-equal "file-name->module-name"
  '(guix foo)
  (file-name->module-name "guix/foo.scm"))

(test-equal "file-name->module-name, leading dot"
  '(guix foo)
  (file-name->module-name "./guix/foo.scm"))

(test-end)
span class='msg-avail'>...Maxim Cournoyer 2022-09-25etc: teams: Add scope support....Mathieu Othacehe 2022-09-05doc: Add more info about commits signature local verification....Andrew Tropin 2022-08-30etc: Add tempel snippets....Nicolas Graves 2022-07-18doc: Fix the example of "Run `make` automatically"...Rostislav Svoboda 2022-07-15monad-repl: Add "build", "lower", and "verbosity" commands....Ludovic Courtès 2022-07-13doc: Prefer "guix show" over "guix package --show"....Ludovic Courtès 2022-07-11doc: Fix cross-reference to Git Info manual....Maxim Cournoyer 2022-07-07doc: Document the documentation process....jgart 2022-05-22doc: Fix typos....Tobias Geerinckx-Rice 2022-05-22import: Add Elm importer....Philip McGrath 2022-05-22guix: Add elm-build-system....Philip McGrath 2022-04-02doc: Document inclusion requirements for new translations....Julien Lepiller 2022-02-15doc: Move build commands to @example for clarity....Ludovic Courtès 2022-01-31doc: Add a rule of thumb to guide enabling new committers....Maxim Cournoyer 2022-01-28doc: Mention how to remedy "source file ... newer than compiled error"....Guix Together 2022-01-28doc: Explain the use of make clean-go when an ABI mismatch occurs....Guix Together 2022-01-10style: Add '--styling' option....Ludovic Courtès 2021-12-20doc: Remove extra closing paren....Ludovic Courtès 2021-12-02doc: Give more details about generating patches with base commit information....Leo Famulari 2021-11-17doc: Improve wording for param spec of `./configure`....Rostislav Svoboda 2021-10-25Add 'guix shell'....Ludovic Courtès 2021-10-14doc: Fix typo....Marius Bakke 2021-10-04maint: Improve default diff hunk header detection....Sarah Morgensen 2021-09-22doc: Add item to "Submitting Patches" section....zimoun 2021-07-05doc: Change Debbugs usertags user to "guix"....Chris Marusich 2021-06-23doc: Document the use of Debbugs usertags....Chris Marusich 2021-06-18doc: Clarify Git commit signing; fix typo....Ludovic Courtès 2021-06-18doc: Explain more reasons for commit revocation....Ludovic Courtès 2021-06-18doc: Add "Addressing Issues" section....Ludovic Courtès 2021-06-18doc: Structure the "Commit Access" section....Ludovic Courtès 2021-06-18Start enabling substitutes from bordeaux.guix.gnu.org....Christopher Baines 2021-06-06doc: Add reference for ‘git-version’ and ‘hg-version’....Xinglu Chen 2021-06-06doc: Pluralize "package."...Matthew James Kraai