guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 06/07: tests: Remove one 'delete-paths' call in 'tests/store.scm'.
Date: Mon, 14 Sep 2020 09:43:28 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8eeeedcb35ac5514360a325116c188ef15f43de6
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Sep 14 14:22:59 2020 +0200

    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.
---
 tests/store.scm | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/tests/store.scm b/tests/store.scm
index 3a2a21a..38051bf 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -223,30 +223,22 @@
            ;;(> freed 0)
            (not (file-exists? p))))))
 
-(test-assert "add-text-to-store vs. delete-paths"
-  ;; Before, 'add-text-to-store' would return PATH2 without noticing that it
-  ;; is no longer valid.
+(test-assert "add-text-to-store/add-to-store vs. delete-paths"
+  ;; Before, 'add-text-to-store' and 'add-to-store' would return the same
+  ;; store item without noticing that it is no longer valid.
   (with-store store
     (let* ((text    (random-text))
-           (path    (add-text-to-store store "delete-me" text))
-           (deleted (delete-paths store (list path)))
-           (path2   (add-text-to-store store "delete-me" text)))
-      (and (string=? path path2)
-           (equal? deleted (list path))
-           (valid-path? store path)
-           (file-exists? path)))))
-
-(test-assert "add-to-store vs. delete-paths"
-  ;; Same as above.
-  (with-store store
-    (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)))))
+           (file    (search-path %load-path "guix.scm"))
+           (path1   (add-text-to-store store "delete-me" text))
+           (path2   (add-to-store store "delete-me" #t "sha256" file))
+           (deleted (delete-paths store (list path1 path2))))
+      (and (string=? path1 (add-text-to-store store "delete-me" text))
+           (string=? path2 (add-to-store store "delete-me" #t "sha256" file))
+           (lset= string=? deleted (list path1 path2))
+           (valid-path? store path1)
+           (valid-path? store path2)
+           (file-exists? path1)
+           (file-exists? path2)))))
 
 (test-equal "add-file-tree-to-store"
   `(42



reply via email to

[Prev in Thread] Current Thread [Next in Thread]