summary refs log tree commit diff
path: root/tests/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-01-29 12:55:24 +0100
committerLudovic Courtès <ludo@gnu.org>2017-01-30 10:52:45 +0100
commit0d268c5d701423b770b05ed208461c47709dafb7 (patch)
tree9ec59a6689ff319624e799275eb1d1abc087d3c7 /tests/store.scm
parent9016dbc2bb469c31915c46cf8a1baecdfe022373 (diff)
downloadguix-0d268c5d701423b770b05ed208461c47709dafb7.tar.gz
store: Add 'add-data-to-store'.
* guix/serialization.scm (write-bytevector): New procedure.
(write-string): Rewrite in terms of 'write-bytevector'.
* guix/store.scm (write-arg): Add 'bytevector' case.
(add-data-to-store): New procedure, from former 'add-text-to-store'.
(add-text-to-store): Rewrite in terms of 'add-data-to-store'.
* tests/store.scm ("add-data-to-store"): New test.
Diffstat (limited to 'tests/store.scm')
-rw-r--r--tests/store.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 983766d862..64d3553f25 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -92,6 +92,11 @@
 
 (test-skip (if %store 0 13))
 
+(test-equal "add-data-to-store"
+  #vu8(1 2 3 4 5)
+  (call-with-input-file (add-data-to-store %store "data" #vu8(1 2 3 4 5))
+    get-bytevector-all))
+
 (test-assert "valid-path? live"
   (let ((p (add-text-to-store %store "hello" "hello, world")))
     (valid-path? %store p)))