From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.bugs Subject: bug#74385: [PATCH 2/4] srfi-64: Use ~s when printing some properties. Date: Sat, 16 Nov 2024 18:42:05 +0100 Message-ID: <20241116174210.9160-2-~@wolfsden.cz> References: <20241116174210.9160-1-~@wolfsden.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17966"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tomas Volf <~@wolfsden.cz> To: 74385@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Nov 16 18:43:21 2024 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tCMpN-0004X1-9G for guile-bugs@m.gmane-mx.org; Sat, 16 Nov 2024 18:43:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCMp8-0007nl-5z; Sat, 16 Nov 2024 12:43:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCMp5-0007mq-GN for bug-guile@gnu.org; Sat, 16 Nov 2024 12:43:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCMp5-0001Sm-6T for bug-guile@gnu.org; Sat, 16 Nov 2024 12:43:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=WXm4UEphxyhnE2VuCaNYiSa3WDO5WWjZLsDijo1q8YQ=; b=ttoq/KyX8z4Fk21I2inQxYJ/oVM30+cZophgERB0doLQzxd9EmTzKE5zxgaRHSYAJ+L3tMlVNMhC2c7X/CsoiWqVI15/KcWvnLSPgCcK45Owx3maK5+gVn7FiGpIsGEgfSucsuiCh74kLozUrJaHx2zj6c5rVssYRlBxHRgDeSsTtWTWiFokqXhQTHMzurBI62AF8A/H9LEKmVYvr0J65T9nzPUcXbTAuKNB3XYU+BQ6N8cA0cJQoY/eNgBP4nfCSI2EYKtjdrkBFZ68HMM6xTwsiBWdi2B56Xli40O7VXTz9vE5KZ0/2ZNd1AkMa4pPeo2vSOYK9o1LxpPDI3zWvQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCMp3-0006fT-VU for bug-guile@gnu.org; Sat, 16 Nov 2024 12:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 16 Nov 2024 17:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74385 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 74385-submit@debbugs.gnu.org id=B74385.173177893825540 (code B ref 74385); Sat, 16 Nov 2024 17:43:01 +0000 Original-Received: (at 74385) by debbugs.gnu.org; 16 Nov 2024 17:42:18 +0000 Original-Received: from localhost ([127.0.0.1]:54675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCMoM-0006dl-8y for submit@debbugs.gnu.org; Sat, 16 Nov 2024 12:42:18 -0500 Original-Received: from wolfsden.cz ([37.205.8.62]:40544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1tCMoL-0006dU-8L for 74385@debbugs.gnu.org; Sat, 16 Nov 2024 12:42:17 -0500 Original-Received: by wolfsden.cz (Postfix, from userid 104) id B97CE35339A; Sat, 16 Nov 2024 17:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1731778936; bh=2RC8ToKAnVyQnvpGsv3zf3uwQMgkb6+EHSYdWFxoSl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OUhSZmZf6BkENpkXmneuHjQS38TUjw8gHAkiVnPZc3ysTOWIum1jUT/wF3tE69rJG WtVaq0nw2nW4knyP6ZfSd+tSvR3gumFmzl3k89hbqXYtEnHf8DfGUAs2ObzVlXYpCQ FJG7NxPruolKpr2ohL0pmX8CaCDK+ZJHPJdRrZE9JToD/iEpxOg/+YFkTXtCiPxux/ LXcRGm8kyReDWLBlVku0oIEQGu21FgRbap8MpRxLwv0AXcYtRptkYq0+/ErtaLx7BF 6YCiMock+cTPvg0CxINQttitaxDzn2LGdziCoQqMvcY7arA+RRe5DCY5r6Gq+vGy3V 6wfWg66r5F+mWjV3OMP8RX5J+I28p8AfbZrW9K/U6v3ED3jdi4tKOoKMFY6BA3lFx8 4WY6o181LyI3LoYjcYVUP9qj/F5FTRA/W0kEYr3kQrISzYX0W4xLQJqXNzbUI/QryG F3G62VeiXsrYKVC0DcH7u4jVBMWlhAvKMnAFWIOcpyr7wFBJfxtjVAi+a3ekf7XNJp P4SL3I+H8Ai29Tdq9gZ5ROcz4T3GAfWlsJ5fmx1vaT49rxC0/jWnI1JFj8HRRAeQy5 EUhaUltQTE1mJ7ssMbbcdsR1LJA67gt6dG555gRJK9mdCBenTuysuWIYVj8vqcdTdB ytlioJ8XaGhxBzRsv69hwR+M= Original-Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 58967351F74; Sat, 16 Nov 2024 17:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1731778936; bh=2RC8ToKAnVyQnvpGsv3zf3uwQMgkb6+EHSYdWFxoSl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OUhSZmZf6BkENpkXmneuHjQS38TUjw8gHAkiVnPZc3ysTOWIum1jUT/wF3tE69rJG WtVaq0nw2nW4knyP6ZfSd+tSvR3gumFmzl3k89hbqXYtEnHf8DfGUAs2ObzVlXYpCQ FJG7NxPruolKpr2ohL0pmX8CaCDK+ZJHPJdRrZE9JToD/iEpxOg/+YFkTXtCiPxux/ LXcRGm8kyReDWLBlVku0oIEQGu21FgRbap8MpRxLwv0AXcYtRptkYq0+/ErtaLx7BF 6YCiMock+cTPvg0CxINQttitaxDzn2LGdziCoQqMvcY7arA+RRe5DCY5r6Gq+vGy3V 6wfWg66r5F+mWjV3OMP8RX5J+I28p8AfbZrW9K/U6v3ED3jdi4tKOoKMFY6BA3lFx8 4WY6o181LyI3LoYjcYVUP9qj/F5FTRA/W0kEYr3kQrISzYX0W4xLQJqXNzbUI/QryG F3G62VeiXsrYKVC0DcH7u4jVBMWlhAvKMnAFWIOcpyr7wFBJfxtjVAi+a3ekf7XNJp P4SL3I+H8Ai29Tdq9gZ5ROcz4T3GAfWlsJ5fmx1vaT49rxC0/jWnI1JFj8HRRAeQy5 EUhaUltQTE1mJ7ssMbbcdsR1LJA67gt6dG555gRJK9mdCBenTuysuWIYVj8vqcdTdB ytlioJ8XaGhxBzRsv69hwR+M= X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241116174210.9160-1-~@wolfsden.cz> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:11099 Archived-At: This will help to properly debug failing tests like: (test-equal "some failing test" "a b " "a b") Before there was no way to tell that one "a b" as extra trailing space, now there is. * module/srfi/srfi-64.scm (test-on-test-end-simple)['expected-value] ['expected-error, 'actual-value, 'actual-error]: Print using ~s. [maybe-print-prop]: Take the code for format as a parameter. --- module/srfi/srfi-64.scm | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm index 13ae26d48..7b3341bf0 100644 --- a/module/srfi/srfi-64.scm +++ b/module/srfi/srfi-64.scm @@ -27,7 +27,6 @@ #:use-module (ice-9 exceptions) #:use-module (ice-9 format) #:use-module (ice-9 match) - #:use-module (ice-9 pretty-print) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) @@ -417,17 +416,11 @@ instead." (define (test-on-test-end-simple runner) "Log that test is done." - (define (maybe-print-prop prop pretty?) + (define (maybe-print-prop prop pretty? code) (let* ((default (list)) (val (test-result-ref runner prop default))) (unless (eq? val default) - (let ((val (string-trim-both - (with-output-to-string - (λ () - (if pretty? - (pretty-print val #:per-line-prefix " ") - (display val))))))) - (format #t "~a: ~a~%" prop val))))) + (format #t "~a: ~@?~&" prop code val)))) (let ((result-kind (test-result-kind runner))) ;; Skip tests not executed due to run list. @@ -436,13 +429,13 @@ instead." result-kind (test-runner-test-name runner)) (unless (member result-kind '(pass xfail)) - (maybe-print-prop 'source-file #f) - (maybe-print-prop 'source-line #f) - (maybe-print-prop 'source-form #t) - (maybe-print-prop 'expected-value #f) - (maybe-print-prop 'expected-error #t) - (maybe-print-prop 'actual-value #f) - (maybe-print-prop 'actual-error #t))))) + (maybe-print-prop 'source-file #f "~a") + (maybe-print-prop 'source-line #f "~a") + (maybe-print-prop 'source-form #t "~y") + (maybe-print-prop 'expected-value #f "~s") + (maybe-print-prop 'expected-error #t "~s") + (maybe-print-prop 'actual-value #f "~s") + (maybe-print-prop 'actual-error #t "~s"))))) (define (test-runner-simple) "Creates a new simple test-runner, that prints errors and a summary on the -- 2.46.0