;;; 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.
;;;
;;; 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)
")
(define description-alist
- ((@@ (guix import cran) description->alist) description))
+ (description->alist description))
(define simple-alist
'(("Key" . "Value")
"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"))
'()
((@@ (guix import cran) listify) simple-alist "BadList"))
-(test-equal "beautify-description: use double spacing"
- "This is a package. It is great. Trust me Mr. Hendrix."
- ((@@ (guix import cran) beautify-description)
- "This is a package. It is great. Trust me Mr. Hendrix."))
-
-(test-equal "beautify-description: transform fragment into sentence"
- "This package provides a function to establish world peace"
- ((@@ (guix import cran) beautify-description)
- "A function to establish world peace"))
+(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
- (lambda* (url file-name #:key (mirrors '()))
+ (lambda* (url file-name
+ #:key
+ (mirrors '()) verify-certificate?)
(with-output-to-file file-name
(lambda ()
(display
("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")
"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.")
- ('license 'gpl3+)))
+ ('license 'gpl3+))
+ #t)
(x
(begin
(format #t "~s\n" x)
(pk 'fail x #f))))))
(test-end "cran")
-
-\f
-(exit (= (test-runner-fail-count (test-runner-current)) 0))