1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

modules: ‘file-name->module-name’ strips leading “./”.

Fixes <https://issues.guix.gnu.org/71979>.

* guix/modules.scm (file-name->module-name): Strip leading “.” component
from FILE.
* tests/modules.scm ("file-name->module-name")
("file-name->module-name, leading dot"): New tests.

Reported-by: Tomas Volf <~@wolfsden.cz>
Change-Id: I3d1b9f3f21448050cac4f3b1aed5f8f03758d4c9
This commit is contained in:
Ludovic Courtès
2024-07-18 17:30:01 +02:00
parent 589c5e2546
commit e3dfed59d3
2 changed files with 13 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016-2017, 2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -65,4 +65,12 @@
(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)