Skip to content

Commit

Permalink
Let diff with golden test file ignore trailling cr
Browse files Browse the repository at this point in the history
For compatibility with windows.
  • Loading branch information
bamboo committed Dec 1, 2024
1 parent 750b85d commit 150e0c9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/test-main.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
(call-with-input-file path
(lambda (p) (read-string 65535 p))))

(define (diff file1 file2)
(system (format #f "diff --strip-trailing-cr --color=auto -u ~a ~a" file1 file2)))

(define* (golden-scene-test scene golden-file)
(let ((output-file "bin/s7_scheme_tests.txt"))
(call-with-output-file output-file
(lambda (p) (write-string (godot scene) p)))
(unless (= 0 (system (format #f "diff --color=auto -u ~a ~a" golden-file output-file)))
(error 'assertion-error "ERROR: output of scene `~a` doesn't match golden file `~a`." scene golden-file))))
(unless (= 0 (diff golden-file output-file))
(error 'assertion-error
"ERROR: output of scene `~a` doesn't match golden file `~a`." scene golden-file))))

(define (golden-scene-tests)
(golden-scene-test
Expand Down

0 comments on commit 150e0c9

Please sign in to comment.