[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#32634] [PATCH 2/2] ui: Add soft port for styling and filtering buil
From: |
Ludovic Courtès |
Subject: |
[bug#32634] [PATCH 2/2] ui: Add soft port for styling and filtering build output. |
Date: |
Mon, 10 Sep 2018 16:28:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
address@hidden (Ludovic Courtès) skribis:
> The brings the issue of how to properly decode build output. Commit
> ce72c780746776a86f59747f5eff8731cb4ff39b fixes issues in this area. I
> wrote the tests below to see how ‘build-output-port’ behaves when passed
> valid UTF-8 and garbage, and it appears to behave correctly, though the
> question mark that we get in return when throwing garbage at it suggests
> that decoding substitution is not happening where it should.
Oops, forgot to send the tests:
diff --git a/tests/ui.scm b/tests/ui.scm
index 1e98e3534..598402db4 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès
<address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +27,8 @@
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-64)
+ #:use-module (rnrs bytevectors)
+ #:use-module (rnrs io ports)
#:use-module (ice-9 regex))
;; Test the (guix ui) module.
@@ -260,4 +262,26 @@ Second line" 24))
"ISO-8859-1")
(show-manifest-transaction store m t))))))))
+(test-equal "build-output-port, UTF-8"
+ "lambda is λ!\n"
+ (let* ((output (open-output-string))
+ (port (build-output-port #:port output #:verbose? #t))
+ (bv (string->utf8 "lambda is λ!\n")))
+ (put-bytevector port bv)
+ (force-output port)
+ ;; Note: 'build-output-port' automatically closes OUTPUT.
+ (get-output-string output)))
+
+(test-equal "current-build-output-port, UTF-8 + garbage"
+ ;; What about a mixture of UTF-8 + garbage?
+ "garbage: ?lambda: λ" ;XXX: why not REPLACEMENT CHARACTER?
+ (let* ((output (open-output-string))
+ (port (build-output-port #:port output #:verbose? #t)))
+ (set-port-conversion-strategy! output 'error)
+ (display "garbage: " port)
+ (put-bytevector port #vu8(128))
+ (put-bytevector port (string->utf8 "lambda: λ"))
+ (force-output port)
+ (get-output-string output)))
+
(test-end "ui")
Ludo’.
[bug#32634] RFC: Process build output, Nils Gillmann, 2018/09/08
[bug#32634] RFC: Process build output, Danny Milosavljevic, 2018/09/09
[bug#32634] RFC: Process build output, Ludovic Courtès, 2018/09/10