gtk and wayland update
[jackhill/guix/guix.git] / tests / cran.scm
index c162d45..5c820b1 100644 (file)
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -17,6 +18,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (test-cran)
+  #:use-module (gnu packages statistics)
   #:use-module (guix import cran)
   #:use-module (guix tests)
   #:use-module (srfi srfi-1)
@@ -34,7 +36,7 @@ Author: Ricardo Wurmus
 Maintainer: Guix Schmeeks <guix@gnu.org>
 URL: http://gnu.org/s/my-example
 Description: This is a long description
-spanning multiple lines: and it could confuse the parser that
+spanning multiple lines: and it could confuse the parser that this line is very long or perhaps the fact that
 there is a colon : on the lines.
   And: this line continues the description.
 biocViews: 0
@@ -51,7 +53,7 @@ Date/Publication: 2015-07-14 14:15:16
 ")
 
 (define description-alist
-  ((@@ (guix import cran) description->alist) description))
+  (description->alist description))
 
 (define simple-alist
   '(("Key"        . "Value")
@@ -70,7 +72,7 @@ Date/Publication: 2015-07-14 14:15:16
                 "Date/Publication")))
     (lset= string=? keys (map car description-alist))))
 
-(test-equal "listify: return empty list if key cannot be found"
+(test-equal "listifyx: return empty list if key cannot be found"
   '()
   ((@@ (guix import cran) listify) simple-alist "Letters"))
 
@@ -86,6 +88,10 @@ Date/Publication: 2015-07-14 14:15:16
   '()
   ((@@ (guix import cran) listify) simple-alist "BadList"))
 
+(test-equal "r-mininal is not a cran package"
+  #f
+  ((@@ (guix import cran) cran-package?) r-minimal))
+
 (test-assert "description->package"
   ;; Replace network resources with sample data.
   (mock ((guix build download) url-fetch
@@ -99,7 +105,7 @@ Date/Publication: 2015-07-14 14:15:16
                   ("mirror://cran/src/contrib/My-Example_1.2.3.tar.gz"
                    "source")
                   (_ (error "Unexpected URL: " url))))))))
-    (match ((@@ (guix import cran) description->package) 'cran description-alist)
+    (match (description->package 'cran description-alist)
       (('package
          ('name "r-my-example")
          ('version "1.2.3")
@@ -111,21 +117,16 @@ Date/Publication: 2015-07-14 14:15:16
                       (? string? hash)))))
          ('properties ('quasiquote (('upstream-name . "My-Example"))))
          ('build-system 'r-build-system)
-         ('inputs
-          ('quasiquote
-           (("cairo" ('unquote 'cairo)))))
+         ('inputs ('list 'cairo))
          ('propagated-inputs
-          ('quasiquote
-           (("r-bh" ('unquote 'r-bh))
-            ("r-proto" ('unquote 'r-proto))
-            ("r-rcpp" ('unquote 'r-rcpp))
-            ("r-scales" ('unquote 'r-scales)))))
+          ('list 'r-bh 'r-proto 'r-rcpp 'r-scales))
          ('home-page "http://gnu.org/s/my-example")
          ('synopsis "Example package")
          ('description
-          "This is a long description spanning multiple lines: \
-and it could confuse the parser that there is a colon : on the \
-lines.  And: this line continues the description.")
+          "\
+This is a long description spanning multiple lines: and it could confuse the
+parser that this line is very long or perhaps the fact that there is a colon :
+on the lines.  And: this line continues the description.")
          ('license 'gpl3+))
        #t)
       (x