summary refs log tree commit diff
path: root/tests/lint.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-11-19 18:06:46 +0100
committerLudovic Courtès <ludo@gnu.org>2016-11-19 18:44:53 +0100
commitfac46e3f5e55f9de6fa2ab8082bc418139590fc0 (patch)
treedc7c03992475f5826a6fa948edf8705feff787d0 /tests/lint.scm
parente74f64b9e55cbc3052698830001238d2407fed19 (diff)
downloadguix-fac46e3f5e55f9de6fa2ab8082bc418139590fc0.tar.gz
lint: Add 'mirror-url' checker.
* guix/scripts/lint.scm (origin-uris): New procedure.
(check-source): Use it.
(check-mirror-url): New procedure.
(%checkers): Add 'mirror-url' checker.
* tests/lint.scm ("mirror-url")
("mirror-url: one suggestion"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
Diffstat (limited to 'tests/lint.scm')
-rw-r--r--tests/lint.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lint.scm b/tests/lint.scm
index cf1b95ee69..0c534562a4 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -508,6 +508,25 @@
           (check-source pkg))))
     "not reachable: 404")))
 
+(test-assert "mirror-url"
+  (string-null?
+   (with-warnings
+     (let ((source (origin
+                     (method url-fetch)
+                     (uri "http://example.org/foo/bar.tar.gz")
+                     (sha256 %null-sha256))))
+       (check-mirror-url (dummy-package "x" (source source)))))))
+
+(test-assert "mirror-url: one suggestion"
+  (string-contains
+   (with-warnings
+     (let ((source (origin
+                     (method url-fetch)
+                     (uri "http://ftp.gnu.org/pub/gnu/foo/foo.tar.gz")
+                     (sha256 %null-sha256))))
+       (check-mirror-url (dummy-package "x" (source source)))))
+   "mirror://gnu/foo/foo.tar.gz"))
+
 (test-assert "cve"
   (mock ((guix scripts lint) package-vulnerabilities (const '()))
         (string-null?