summary refs log tree commit diff
path: root/tests/hackage.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-26 23:18:21 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-26 23:20:30 +0200
commitad7466aafd7f166d0b6be5eb32dda1d3ee8a6445 (patch)
tree5984728bf94a6b3cb11140b9bb986c573cf59d05 /tests/hackage.scm
parent002d17dcaacba0f86265b34f2509419d9e21224d (diff)
downloadguix-ad7466aafd7f166d0b6be5eb32dda1d3ee8a6445.tar.gz
import: hackage: Fix Cabal test.
* guix/import/hackage.scm (hackage->guix-package): Remove call to 'memoize'.
(hackage->guix-package/m): New procedure.
(hackage-recursive-import): Use it.
* tests/hackage.scm ("hackage->guix-package test 6"): Adjust.

Co-authored-by: Robert Vollmert <rob@vllmrt.net>
Diffstat (limited to 'tests/hackage.scm')
-rw-r--r--tests/hackage.scm37
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm
index e17851a213..0efad0638d 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -207,8 +207,41 @@ library
                         #:cabal-environment '(("impl" . "ghc-7.8"))))
 
 (test-assert "hackage->guix-package test 6"
-  (eval-test-with-cabal test-cabal-6
-                        #:cabal-environment '(("impl" . "ghc-7.8"))))
+  (mock
+   ((guix import hackage) hackage-fetch
+    (lambda (name-version)
+      (call-with-input-string test-cabal-6
+        read-cabal)))
+   (match (hackage->guix-package "foo")
+     (('package
+        ('name "ghc-foo")
+        ('version "1.0.0")
+        ('source
+         ('origin
+           ('method 'url-fetch)
+           ('uri ('string-append
+                  "https://hackage.haskell.org/package/foo/foo-"
+                  'version
+                  ".tar.gz"))
+           ('sha256
+            ('base32
+             (? string? hash)))))
+        ('build-system 'haskell-build-system)
+        ('inputs
+         ('quasiquote
+          (("ghc-b" ('unquote 'ghc-b))
+           ("ghc-http" ('unquote 'ghc-http))
+           ("ghc-mtl" ('unquote 'ghc-mtl)))))
+        ('native-inputs
+         ('quasiquote
+          (("ghc-haskell-gi" ('unquote 'ghc-haskell-gi)))))
+        ('home-page "http://test.org")
+        ('synopsis (? string?))
+        ('description (? string?))
+        ('license 'bsd-3))
+      #t)
+     (x
+      (pk 'fail x #f)))))
 
 (test-assert "read-cabal test 1"
   (match (call-with-input-string test-read-cabal-1 read-cabal)