guix-commits
[Top][All Lists]
Advanced

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

04/05: lint: Add tests for the 'source' checker.


From: Ludovic Courtès
Subject: 04/05: lint: Add tests for the 'source' checker.
Date: Thu, 05 Mar 2015 21:22:50 +0000

civodul pushed a commit to branch master
in repository guix.

commit 950d2ea414f3ce11e68f059ccef7f5e6a6181778
Author: Ludovic Courtès <address@hidden>
Date:   Thu Mar 5 22:16:01 2015 +0100

    lint: Add tests for the 'source' checker.
    
    * guix/scripts/lint.scm (check-source): Export.
    * tests/lint.scm (%null-sha256): New procedure.
      ("source: 200", "source: 404"): New tests.
---
 guix/scripts/lint.scm |    3 ++-
 tests/lint.scm        |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index fef0563..69717b6 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -47,7 +47,8 @@
             check-inputs-should-be-native
             check-patches
             check-synopsis-style
-            check-home-page))
+            check-home-page
+            check-source))
 
 
 ;;;
diff --git a/tests/lint.scm b/tests/lint.scm
index e0b1e67..c059922 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -46,6 +46,11 @@
   (string-append "http://localhost:"; (number->string %http-server-port)
                  "/foo/bar"))
 
+(define %null-sha256
+  ;; SHA256 of the empty string.
+  (base32
+   "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73"))
+
 (define %http-server-socket
   ;; Socket used by the Web server.
   (catch 'system-error
@@ -363,6 +368,34 @@ requests."
           (check-home-page pkg))))
     "not reachable: 404")))
 
+(test-skip (if %http-server-socket 0 1))
+(test-equal "source: 200"
+  ""
+  (with-warnings
+   (with-http-server 200
+     (let ((pkg (package
+                  (inherit (dummy-package "x"))
+                  (source (origin
+                            (method url-fetch)
+                            (uri %local-url)
+                            (sha256 %null-sha256))))))
+       (check-source pkg)))))
+
+(test-skip (if %http-server-socket 0 1))
+(test-assert "source: 404"
+  (->bool
+   (string-contains
+    (with-warnings
+      (with-http-server 404
+        (let ((pkg (package
+                     (inherit (dummy-package "x"))
+                     (source (origin
+                               (method url-fetch)
+                               (uri %local-url)
+                               (sha256 %null-sha256))))))
+          (check-source pkg))))
+    "not reachable: 404")))
+
 (test-end "lint")
 
 



reply via email to

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