gnu: plantuml: Update to 1.2020.16.
[jackhill/guix/guix.git] / tests / lint.scm
index ac174f9..95abd71 100644 (file)
      (check-patch-file-names pkg))))
 
 (test-equal "patches: not found"
-  "this-patch-does-not-exist!: patch not found"
+  "this-patch-does-not-exist!: patch not found\n"
   (single-lint-warning-message
    (let ((pkg (dummy-package
                "x"
                              (origin
                                (method git-fetch)
                                (uri (git-reference
-                                     (url "https://github.com/archive/example.git")
+                                     (url "https://github.com/archive/example")
                                      (commit "0")))
                                (sha256 %null-sha256))))))
     (check-source-unstable-tarball pkg)))
                 (and (? lint-warning?) second-warning))
                (lint-warning-message second-warning)))))))))
 
+(test-skip (if (http-server-can-listen?) 0 1))
+(test-equal "source, git-reference: 301 -> 200"
+  "permanent redirect from http://localhost:10000/foo/bar to http://localhost:9999/foo/bar"
+  (with-http-server `((200 ,%long-string))
+    (let* ((initial-url (%local-url))
+           (redirect    (build-response #:code 301
+                                        #:headers
+                                        `((location
+                                           . ,(string->uri initial-url))))))
+      (parameterize ((%http-server-port (+ 1 (%http-server-port))))
+        (with-http-server `((,redirect ""))
+          (let ((pkg (dummy-package
+                      "x"
+                      (source (origin
+                                (method git-fetch)
+                                (uri (git-reference (url (%local-url))
+                                                    (commit "v1.0.0")))
+                                (sha256 %null-sha256))))))
+            (single-lint-warning-message (check-source pkg))))))))
+
 (test-skip (if (http-server-can-listen?) 0 1))
 (test-equal "source: 301 -> 404"
   "URI http://localhost:10000/foo/bar not reachable: 404 (\"Such is life\")"