aboutsummaryrefslogtreecommitdiff
path: root/module/hnh/test/testrunner.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 15:04:30 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 15:04:30 +0200
commit0d600b53df3ab20cc3b9ab84ee5c79e5afe41b96 (patch)
treef7fd385a9a24337e8a302dffe2e9bee0bc180d80 /module/hnh/test/testrunner.scm
parentAdd number of clearifying comments + minor cleanup. (diff)
downloadcalp-0d600b53df3ab20cc3b9ab84ee5c79e5afe41b96.tar.gz
calp-0d600b53df3ab20cc3b9ab84ee5c79e5afe41b96.tar.xz
Better test diffs for strings.
Previously everything was passed through pretty print, meaning that strings would be squashed to one line. Instead handle strings separately, and do a line diff on them, but still pretty print actual scheme structures. Also change display to write to be able to differentiate different forms which prints the same.
Diffstat (limited to 'module/hnh/test/testrunner.scm')
-rw-r--r--module/hnh/test/testrunner.scm14
1 files changed, 6 insertions, 8 deletions
diff --git a/module/hnh/test/testrunner.scm b/module/hnh/test/testrunner.scm
index b3951c34..a45bd421 100644
--- a/module/hnh/test/testrunner.scm
+++ b/module/hnh/test/testrunner.scm
@@ -19,7 +19,7 @@
(with-output-to-string
(lambda () (pretty-print
form
- display?: #t
+ display?: #f
per-line-prefix: prefix
width: (- 79 (string-length indent)))))
(string-append indent prefix-1))))
@@ -61,13 +61,11 @@
(begin
(display (pp expected indent "Expected: "))
(display (pp actual indent "Received: "))
- (let ((d (diff (pp expected "" "")
- (pp actual "" ""))))
- (display
- (string-join
- (map (lambda (line) (string-append indent "|" line))
- (string-split d #\newline))
- "\n" 'suffix))))))))))
+ (display
+ (string-join
+ (map (lambda (line) (string-append indent "|" line))
+ (string-split (diff expected actual) #\newline))
+ "\n" 'suffix)))))))))
(format #t "~aNear ~a:~a~%"
(make-indent (1+ depth))