From: Tomas Volf <~@wolfsden.cz>
To: 74385@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: bug#74385: [PATCH 2/4] srfi-64: Use ~s when printing some properties.
Date: Sat, 16 Nov 2024 18:42:05 +0100 [thread overview]
Message-ID: <20241116174210.9160-2-~@wolfsden.cz> (raw)
In-Reply-To: <20241116174210.9160-1-~@wolfsden.cz>
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
next prev parent reply other threads:[~2024-11-16 17:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-16 17:39 bug#74385: [PATCH 0/4] Patches for SRFI-64 Tomas Volf
2024-11-16 17:42 ` bug#74385: [PATCH 1/4] srfi-64: Fix maybe-print-prop Tomas Volf
2024-11-16 17:42 ` Tomas Volf [this message]
2024-11-16 17:42 ` bug#74385: [PATCH 3/4] srfi-64: Export define-equality-test Tomas Volf
2024-11-16 17:42 ` bug#74385: [PATCH 4/4] srfi-64: Report failed tests in (standards)Errors format Tomas Volf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='20241116174210.9160-2-~@wolfsden.cz' \
--to=~@wolfsden.cz \
--cc=74385@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).