summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-05-18 21:57:49 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-22 00:35:23 +0200
commit73b27eaa64d90051870242464543153b8bcb95de (patch)
tree1dd16db348ba18d4cc5b4c44197ef1965c22942d
parent1ad5209d904d471ded6cf53b4e29b64e963dea3f (diff)
downloadguix-73b27eaa64d90051870242464543153b8bcb95de.tar.gz
tests: Test 'add-to-store' with several hash algorithms.
* tests/store.scm ("add-to-store"): New test.
-rw-r--r--tests/store.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 0af099c1ad..f007846dc1 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -115,6 +115,18 @@
                                 (passwd:name (getpwuid (getuid)))))))
     (list (stat:uid s) (stat:perms s))))
 
+(test-equal "add-to-store"
+  '("sha1" "sha256" "sha512")
+  (let* ((file    (search-path %load-path "guix.scm"))
+         (content (call-with-input-file file get-bytevector-all)))
+    (map (lambda (hash-algo)
+           (let ((file (add-to-store %store "guix.scm" #f hash-algo file)))
+             (and (direct-store-path? file)
+                  (bytevector=? (call-with-input-file file get-bytevector-all)
+                                content)
+                  hash-algo)))
+         '("sha1" "sha256" "sha512"))))
+
 (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))