From a77adfe022378fe3364d0d742203bac45746a4b9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 24 Sep 2015 12:04:30 +0200 Subject: tests: cran: Use cran-uri in expected output. * tests/cran.scm: Expect output to use "cran-uri" procedure. --- tests/cran.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/cran.scm b/tests/cran.scm index c9cb5f69d0..ba5699a133 100644 --- a/tests/cran.scm +++ b/tests/cran.scm @@ -149,8 +149,7 @@ ('version "1.2.3") ('source ('origin ('method 'url-fetch) - ('uri ('string-append "mirror://cran/src/contrib/my-example-sxml_" - 'version ".tar.gz")) + ('uri ('cran-uri "my-example-sxml" 'version)) ('sha256 ('base32 (? string? hash))))) -- cgit v1.2.3 From 08d7e3592faa93f508cd7f0c30199fe53c87892b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Sep 2015 21:56:42 +0200 Subject: ui: Gracefully handle Unicode description strings. Fixes . Reported by Alex Kost . * guix/ui.scm (texi->plain-text): Wrap body in 'with-fluids'. * tests/ui.scm ("package-description-string vs. Unicode"): New test. --- guix/ui.scm | 5 ++++- tests/ui.scm | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/guix/ui.scm b/guix/ui.scm index 4a3630f242..67dd062a34 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -803,7 +803,10 @@ converted to a space; sequences of more than one line break are preserved." (define (texi->plain-text str) "Return a plain-text representation of texinfo fragment STR." - (stexi->plain-text (texi-fragment->stexi str))) + ;; 'texi-fragment->stexi' uses a string port so make sure it's a + ;; Unicode-capable one (see .) + (with-fluids ((%default-port-encoding "UTF-8")) + (stexi->plain-text (texi-fragment->stexi str)))) (define (package-description-string package) "Return a plain-text representation of PACKAGE description field." diff --git a/tests/ui.scm b/tests/ui.scm index 25fc709431..bd4c907525 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -22,6 +22,7 @@ #:use-module (guix profiles) #:use-module (guix store) #:use-module (guix derivations) + #:use-module (guix tests) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) @@ -89,6 +90,12 @@ interface, and powerful string processing.") (fill-paragraph "First line. Second line" 24)) +(test-equal "package-description-string vs. Unicode" + "b•ll•t\n\n" ;see + (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") -- cgit v1.2.3