aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-04-22 23:07:13 +0200
committerLudovic Courtès <ludo@gnu.org>2013-04-22 23:07:13 +0200
commitd66c70967f9bd792acdd00036292dc0a7b858742 (patch)
tree90e60b8fa1c2aa5e491d314c805f39cf4b11444f /tests
parentb2a886f6c7c8424ce024020aaa8927be9811f40b (diff)
downloadgnu-guix-d66c70967f9bd792acdd00036292dc0a7b858742.tar
gnu-guix-d66c70967f9bd792acdd00036292dc0a7b858742.tar.gz
packages: Add `package-field-location'.
* guix/packages.scm (package-field-location): New procedure. * build-aux/sync-synopses.scm: Use it instead of `package-location'. * tests/packages.scm ("package-field-location"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index c5d9d280ed..bf82aba858 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -52,6 +52,27 @@
(home-page #f) (license #f)
extra-fields ...))
+(test-assert "package-field-location"
+ (let ()
+ (define (goto port line column)
+ (unless (and (= (port-column port) (- column 1))
+ (= (port-line port) (- line 1)))
+ (unless (eof-object? (get-char port))
+ (goto port line column))))
+
+ (define read-at
+ (match-lambda
+ (($ <location> file line column)
+ (call-with-input-file (search-path %load-path file)
+ (lambda (port)
+ (goto port line column)
+ (read port))))))
+
+ (and (equal? (read-at (package-field-location %bootstrap-guile 'name))
+ (package-name %bootstrap-guile))
+ (equal? (read-at (package-field-location %bootstrap-guile 'version))
+ (package-version %bootstrap-guile)))))
+
(test-assert "package-transitive-inputs"
(let* ((a (dummy-package "a"))
(b (dummy-package "b"