From 8531997d2a1e10d574a6e9ab70bc86ade6af4733 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 7 Sep 2021 21:19:11 +0200 Subject: packages: Add 'package-definition-location'. Suggested by Maxime Devos . * guix/packages.scm (current-definition-location): New syntax parameter. (define-public*): New macro. ()[definition-location]: New field. (package-definition-location): New procedure. * tests/packages.scm ("package-definition-location"): New test. --- tests/packages.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3