tests: Remove one 'delete-paths' call in 'tests/store.scm'.

This makes the test slightly less expensive.

* tests/store.scm ("add-text-to-store vs. delete-paths")
("add-to-store vs. delete-paths"): Delete and merge into...
("add-text-to-store/add-to-store vs. delete-paths"): ... this test.
This commit is contained in:
Ludovic Courtès 2020-09-14 14:22:59 +02:00
parent 7d516c17da
commit 8eeeedcb35
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -223,30 +223,22 @@ (define %shell
;;(> freed 0) ;;(> freed 0)
(not (file-exists? p)))))) (not (file-exists? p))))))
(test-assert "add-text-to-store vs. delete-paths" (test-assert "add-text-to-store/add-to-store vs. delete-paths"
;; Before, 'add-text-to-store' would return PATH2 without noticing that it ;; Before, 'add-text-to-store' and 'add-to-store' would return the same
;; is no longer valid. ;; store item without noticing that it is no longer valid.
(with-store store (with-store store
(let* ((text (random-text)) (let* ((text (random-text))
(path (add-text-to-store store "delete-me" text)) (file (search-path %load-path "guix.scm"))
(deleted (delete-paths store (list path))) (path1 (add-text-to-store store "delete-me" text))
(path2 (add-text-to-store store "delete-me" text))) (path2 (add-to-store store "delete-me" #t "sha256" file))
(and (string=? path path2) (deleted (delete-paths store (list path1 path2))))
(equal? deleted (list path)) (and (string=? path1 (add-text-to-store store "delete-me" text))
(valid-path? store path) (string=? path2 (add-to-store store "delete-me" #t "sha256" file))
(file-exists? path))))) (lset= string=? deleted (list path1 path2))
(valid-path? store path1)
(test-assert "add-to-store vs. delete-paths" (valid-path? store path2)
;; Same as above. (file-exists? path1)
(with-store store (file-exists? path2)))))
(let* ((file (search-path %load-path "guix.scm"))
(path (add-to-store store "delete-me" #t "sha256" file))
(deleted (delete-paths store (list path)))
(path2 (add-to-store store "delete-me" #t "sha256" file)))
(and (string=? path path2)
(equal? deleted (list path))
(valid-path? store path)
(file-exists? path)))))
(test-equal "add-file-tree-to-store" (test-equal "add-file-tree-to-store"
`(42 `(42