From 6f38960055e496193a49d690d7f1b5516b2b8625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 8 Mar 2017 15:04:18 +0100 Subject: hash: Close or flush sha256 output ports before calling their 'get' procedure. Slightly different buffering of custom binary output ports in Guile 2.1.7 would lead tests missing 'close-port' or 'force-output' to fail. * tests/hash.scm ("open-sha256-port, hello"): Add call to 'force-output' before call to 'get'. * tests/nar.scm ("write-file puts file in C locale collation order"): Call 'close-port' before calling 'get-hash'. --- tests/hash.scm | 3 ++- tests/nar.scm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/hash.scm b/tests/hash.scm index 8039549971..86501dca2d 100644 --- a/tests/hash.scm +++ b/tests/hash.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014 Ludovic Courtès +;;; Copyright © 2013, 2014, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -67,6 +67,7 @@ In Guile <= 2.0.9, CBIPs were always fully buffered, so the (let-values (((port get) (open-sha256-port))) (put-bytevector port (string->utf8 "hello world")) + (force-output port) (get))) (test-assert "port-sha256" diff --git a/tests/nar.scm b/tests/nar.scm index 4f4b304b1d..28ead8b783 100644 --- a/tests/nar.scm +++ b/tests/nar.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -186,6 +186,7 @@ (lambda () (let-values (((port get-hash) (open-sha256-port))) (write-file input port) + (close-port port) (get-hash))) (lambda () (rm-rf input))))) -- cgit v1.2.3 From dd420bf3430eb644b93ca224da4c0a3f5db7a42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 8 Mar 2017 15:22:07 +0100 Subject: tests: Avoid zero-expression 'begin' form. * tests/cran.scm ("description->package"): Add body after the expected pattern in 'match'. --- tests/cran.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/cran.scm b/tests/cran.scm index f92934c468..c162d45d8a 100644 --- a/tests/cran.scm +++ b/tests/cran.scm @@ -126,7 +126,8 @@ Date/Publication: 2015-07-14 14:15:16 "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) -- cgit v1.2.3 From 1062063a65036f32a061c54866d33ffe079ec44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 8 Mar 2017 22:21:31 +0100 Subject: ui: Don't use '%default-port-encoding' to set the encoding of string ports. * guix/ui.scm (right-arrow): Call 'set-port-encoding!' to set PORT's encoding; remove use of 'with-fluids'. This is for compatibility with Guile 2.2 where the encoding of string ports is not influenced by %DEFAULT-PORT-ENCODING. * tests/ui.scm ("show-manifest-transaction"): Likewise. --- tests/ui.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/ui.scm b/tests/ui.scm index 058207e8b9..cfe417d497 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -248,9 +248,12 @@ Second line" 24)) (lambda () (show-manifest-transaction store m t))))) (string-match "guile\t1.8.8 -> 2.0.9" - (with-fluids ((%default-port-encoding "ISO-8859-1")) - (with-error-to-string - (lambda () - (show-manifest-transaction store m t))))))))) + (with-error-to-string + (lambda () + ;; In Guile 2.2, %DEFAULT-PORT-ENCODING doesn't + ;; influence the encoding of string ports. + (set-port-encoding! (current-error-port) + "ISO-8859-1") + (show-manifest-transaction store m t)))))))) (test-end "ui") -- cgit v1.2.3