aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-04-18 08:04:15 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-04-18 08:13:20 +0200
commit0d6f3efa87ca8bd3700152f656ce61e63ee32e7e (patch)
treeb27b44bf63ffe54a3401799897f1f2f31bb208f8
parentImport test cases from RFC 4791 (CalDAV). (diff)
downloadcalp-0d6f3efa87ca8bd3700152f656ce61e63ee32e7e.tar.gz
calp-0d6f3efa87ca8bd3700152f656ce61e63ee32e7e.tar.xz
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 ...)
-rwxr-xr-xtests/run-tests.scm19
1 files 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)