;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
#:use-module (guix profiles)
#:use-module (guix store)
#:use-module (guix derivations)
- #:use-module ((guix scripts build)
- #:select (%standard-build-options))
+ #:use-module (guix tests)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
(item "/gnu/store/...")
(output "out")))
-(define-syntax-rule (with-environment-variable variable value body ...)
- "Run BODY with VARIABLE set to VALUE."
- (let ((orig (getenv variable)))
- (dynamic-wind
- (lambda ()
- (setenv variable value))
- (lambda ()
- body ...)
- (lambda ()
- (if orig
- (setenv variable orig)
- (unsetenv variable))))))
-
\f
(test-begin "ui")
-(test-equal "parse-command-line"
- '((argument . "bar") (argument . "foo")
- (cores . 10) ;takes precedence
- (substitutes? . #f) (keep-failed? . #t)
- (max-jobs . 77) (cores . 42))
-
- (with-environment-variable "GUIX_BUILD_OPTIONS" "-c 42 -M 77"
- (parse-command-line '("--keep-failed" "--no-substitutes"
- "--cores=10" "foo" "bar")
- %standard-build-options
- (list '()))))
-
-(test-equal "parse-command-line and --no options"
- '((argument . "foo")
- (substitutes? . #f)) ;takes precedence
-
- (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes"
- (parse-command-line '("foo")
- %standard-build-options
- (list '((substitutes? . #t))))))
-
(test-assert "fill-paragraph"
(every (lambda (column)
(every (lambda (width)
(fill-paragraph "First line.
Second line" 24))
+(test-equal "package-description-string vs. Unicode"
+ "b•ll•t\n\n" ;see <http://bugs.gnu.org/21536>
+ (with-fluids ((%default-port-encoding "ISO-8859-1"))
+ (package-description-string
+ (dummy-package "foo" (description "b•ll•t")))))
+
(test-equal "package-specification->name+version+output"
'(("guile" #f "out")
("guile" "2.0.9" "out")
(package-specification->name+version+output spec))
list))
'("guile"
- "guile-2.0.9"
+ "guile@2.0.9"
"guile:debug"
- "guile-2.0.9:debug"
- "guile-cairo-1.4.1")))
+ "guile@2.0.9:debug"
+ "guile-cairo@1.4.1")))
(test-equal "integer"
'(1)
(string->duration "1m")
(string->duration "30d"))
+(test-equal "duration, 1 second"
+ (make-time time-duration 0 1)
+ (string->duration "1s"))
+
(test-equal "duration, integer"
#f
(string->duration "1"))
(show-manifest-transaction store m t)))))))))
(test-end "ui")
-
-\f
-(exit (= (test-runner-fail-count (test-runner-current)) 0))
-
-;;; Local Variables:
-;;; eval: (put 'with-environment-variable 'scheme-indent-function 2)
-;;; End: