From 0d6f3efa87ca8bd3700152f656ce61e63ee32e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 18 Apr 2023 08:04:15 +0200 Subject: Move test runner diff to variable. A first step towards making diff configurable. As can already be seen with the (out commented) alternative (git diff ...) --- tests/run-tests.scm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/run-tests.scm b/tests/run-tests.scm index dbd67b7e..dfa9df8a 100755 --- a/tests/run-tests.scm +++ b/tests/run-tests.scm @@ -39,6 +39,10 @@ fi +(define diff-cmd '("diff") + ;; '("git" "diff" "--no-index" "--word-diff=color") + ) + (define (µs x) (* x #e1e6)) @@ -64,15 +68,12 @@ fi 0 (string-length s2))) (define (diff s1 s2) - (let ((filename1 (call-with-tmpfile (lambda (p f) (display s1 p) f))) - (filename2 (call-with-tmpfile (lambda (p f) (display s2 p) f)))) - (let ((pipe (open-pipe* - OPEN_READ - ;; "git" "diff" "--no-index" - "diff" - filename1 filename2))) - (begin1 (begin - (read-string pipe)) + (let ((filename1 (call-with-tmpfile (lambda (p f) (pretty-print s1 p display?: #t) f))) + (filename2 (call-with-tmpfile (lambda (p f) (pretty-print s2 p display?: #t) f)))) + (let ((pipe (apply open-pipe* + OPEN_READ + (append diff-cmd (list filename1 filename2))))) + (begin1 (read-string pipe) (close-pipe pipe))))) (define (pp form indent prefix-1) -- cgit v1.2.3