diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-09-07 21:19:11 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-09-13 12:31:10 +0200 |
commit | 8531997d2a1e10d574a6e9ab70bc86ade6af4733 (patch) | |
tree | 5c1cdaff85b4cba539fe84ba5c3c87fb9217408e /tests/packages.scm | |
parent | 10c981b1355df694b277a812cd8beb7cd60d1ea6 (diff) | |
download | guix-8531997d2a1e10d574a6e9ab70bc86ade6af4733.tar guix-8531997d2a1e10d574a6e9ab70bc86ade6af4733.tar.gz |
packages: Add 'package-definition-location'.
Suggested by Maxime Devos <maximedevos@telenet.be>.
* guix/packages.scm (current-definition-location): New syntax parameter.
(define-public*): New macro.
(<package>)[definition-location]: New field.
(package-definition-location): New procedure.
* tests/packages.scm ("package-definition-location"): New test.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r-- | tests/packages.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm index 2a290bc353..3756877270 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -236,6 +236,17 @@ (eq? item new))) (null? (manifest-transaction-remove tx))))))) +(test-assert "package-definition-location" + (let ((location (package-location hello)) + (definition (package-definition-location hello))) + ;; Check for the usual layout of (define-public hello (package ...)). + (and (string=? (location-file location) + (location-file definition)) + (= 0 (location-column definition)) + (= 2 (location-column location)) + (= (location-line definition) + (- (location-line location) 1))))) + (test-assert "package-field-location" (let () (define (goto port line column) |