gnu: Properly credit Konrad Hinsen.
[jackhill/guix/guix.git] / tests / packages.scm
index 6aa3617..cbd0503 100644 (file)
@@ -23,7 +23,8 @@
   #:use-module (guix monads)
   #:use-module (guix grafts)
   #:use-module ((guix gexp) #:select (local-file local-file-file))
-  #:use-module ((guix utils)
+  #:use-module (guix utils)
+  #:use-module ((guix diagnostics)
                 ;; Rename the 'location' binding to allow proper syntax
                 ;; matching when setting the 'location' field of a package.
                 #:renamer (lambda (name)
          (string=? (derivation->output-path drv)
                    (package-output %store package "out")))))
 
-(test-assert "patch not found yields a run-time error"
-  (guard (c ((condition-has-type? c &message)
-             (and (string-contains (condition-message c)
-                                   "does-not-exist.patch")
-                  (string-contains (condition-message c)
-                                   "not found"))))
+(test-equal "patch not found yields a run-time error"
+  '("~a: patch not found\n" "does-not-exist.patch")
+  (guard (c ((formatted-message? c)
+             (cons (formatted-message-string c)
+                   (formatted-message-arguments c))))
     (let ((p (package
                (inherit (dummy-package "p"))
                (source (origin
                                                       result))
                                               '()))))))
 
+    (define (find-duplicates l)
+      (match l
+        (() '())
+        ((head . tail)
+         (if (member head tail)
+             (cons head (find-duplicates tail))
+             (find-duplicates tail)))))
+
+    (pk (find-duplicates from-cache))
     (and (equal? (delete-duplicates from-cache) from-cache)
          (lset= equal? no-cache from-cache))))