summary refs log tree commit diff
path: root/tests/store.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-03-17 10:19:36 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-04-04 13:50:52 -0400
commit533d1768f47520ac7010adc550b0dd9783ebb011 (patch)
tree6b329f3d97c95f75bb5d9e00f485f0ba5cc4ae4c /tests/store.scm
parent4cd27cd60ab2e8246fff1372a469f2a0d6b41bb2 (diff)
downloadguix-533d1768f47520ac7010adc550b0dd9783ebb011.tar.gz
store: Add query-path-info operation.
* guix/store.scm (<path-info>): New record type.
  (read-path-info): New procedure.
  (read-arg): Add 'path-info' syntax.
  (query-path-info): New variable.
* tests/store.scm ("query-path-info"): New test.
Diffstat (limited to 'tests/store.scm')
-rw-r--r--tests/store.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index f778c2086d..eeceed45c1 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -606,6 +606,16 @@
          (file (add %store "foo" "Lowered.")))
     (call-with-input-file file get-string-all)))
 
+(test-assert "query-path-info"
+  (let* ((ref (add-text-to-store %store "ref" "foo"))
+         (item (add-text-to-store %store "item" "bar" (list ref)))
+         (info (query-path-info %store item)))
+    (and (equal? (path-info-references info) (list ref))
+         (equal? (path-info-hash info)
+                 (sha256
+                  (string->utf8
+                   (call-with-output-string (cut write-file item <>))))))))
+
 (test-end "store")