guix-commits
[Top][All Lists]
Advanced

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

01/04: tests: Relax expectations for the 'home-page' checker.


From: guix-commits
Subject: 01/04: tests: Relax expectations for the 'home-page' checker.
Date: Sat, 17 Aug 2019 10:23:41 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 37592014e13abead7a691d0dcb5918d1a10f5cd6
Author: Ludovic Courtès <address@hidden>
Date:   Sat Aug 17 15:34:24 2019 +0200

    tests: Relax expectations for the 'home-page' checker.
    
    Fixes a regression introduced in
    50fc2384feb3bb2677d074f8f0deb5ae3c56b4d8.
    
    * tests/lint.scm (warning-contains?): New procedure.
    ("home-page: host not found"): Use 'warning-contains?' instead of
    testing for equality, as was the case before commit 50fc2384feb.
    This handles the case where the 'getaddrinfo' error is not "Name or
    service not known" but instead something like "System error" or
    "Servname not supported for ai_socktype", as is the case in the build
    environment.
---
 tests/lint.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/lint.scm b/tests/lint.scm
index 8a9023a..db6dd6d 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -74,6 +74,12 @@
     (((and (? lint-warning?) warning))
      (lint-warning-message warning))))
 
+(define (warning-contains? str warnings)
+  "Return true if WARNINGS is a singleton with a warning that contains STR."
+  (match warnings
+    (((? lint-warning? warning))
+     (string-contains (lint-warning-message warning) str))))
+
 
 (test-begin "lint")
 
@@ -366,13 +372,11 @@
     (single-lint-warning-message
      (check-home-page pkg))))
 
-(test-equal "home-page: host not found"
-  "URI http://does-not-exist domain not found: Name or service not known"
+(test-assert "home-page: host not found"
   (let ((pkg (package
                (inherit (dummy-package "x"))
                (home-page "http://does-not-exist";))))
-    (single-lint-warning-message
-     (check-home-page pkg))))
+    (warning-contains? "domain not found" (check-home-page pkg))))
 
 (test-skip (if (http-server-can-listen?) 0 1))
 (test-equal "home-page: Connection refused"



reply via email to

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