summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-15 10:38:46 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-15 15:26:30 +0200
commitda675305ddf2ba574e309e515d18ae1f778297be (patch)
tree3ba9f81530c70b315a9235861e27e19ddb0ad97e /tests
parent789510640d8ac30298c45d0edc80ec9078aa3afd (diff)
packages: The 'source' can be any lowerable object.
* guix/packages.scm (expand-input): Use 'struct?' instead of 'origin?' when matching SOURCE. (package-source-derivation): Use 'lower-object' instead of 'origin->derivation'. * tests/packages.scm ("package-source-derivation, local-file"): New test. * doc/guix.texi (package Reference): Update 'source' documentation accordingly.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 94e8150b750..d3f432ada27 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -21,6 +21,7 @@
21 #:use-module (guix store) 21 #:use-module (guix store)
22 #:use-module (guix monads) 22 #:use-module (guix monads)
23 #:use-module (guix grafts) 23 #:use-module (guix grafts)
24 #:use-module ((guix gexp) #:select (local-file local-file-file))
24 #:use-module ((guix utils) 25 #:use-module ((guix utils)
25 ;; Rename the 'location' binding to allow proper syntax 26 ;; Rename the 'location' binding to allow proper syntax
26 ;; matching when setting the 'location' field of a package. 27 ;; matching when setting the 'location' field of a package.
@@ -295,6 +296,20 @@
295 (and (direct-store-path? source) 296 (and (direct-store-path? source)
296 (string-suffix? "utils.scm" source)))) 297 (string-suffix? "utils.scm" source))))
297 298
299(test-assert "package-source-derivation, local-file"
300 (let* ((file (local-file "../guix/base32.scm"))
301 (package (package (inherit (dummy-package "p"))
302 (source file)))
303 (source (package-source-derivation %store
304 (package-source package))))
305 (and (store-path? source)
306 (string-suffix? "base32.scm" source)
307 (valid-path? %store source)
308 (equal? (call-with-input-file source get-bytevector-all)
309 (call-with-input-file
310 (search-path %load-path "guix/base32.scm")
311 get-bytevector-all)))))
312
298(unless (network-reachable?) (test-skip 1)) 313(unless (network-reachable?) (test-skip 1))
299(test-equal "package-source-derivation, snippet" 314(test-equal "package-source-derivation, snippet"
300 "OK" 315 "OK"