>From a40176fe7b5f3a6706469922dde0fca422f1a6e4 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart
Date: Thu, 6 Mar 2014 22:59:20 -0300 Subject: [PATCH] Drop requirement on external program dos2unix for tests Add a quick&dirty scheme program (tests/dos2unix.scm) to replace the external program dos2unix which is not always available on Windows systems. As a bonus, by using a scheme program we indirectly introduce new tests (e.g., binary I/O). --- distribution/manifest | 1 + tests/dos2unix.scm | 30 ++++++++++++++++++++++++++++++ tests/runtests.sh | 8 ++------ 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 tests/dos2unix.scm diff --git a/distribution/manifest b/distribution/manifest index 791389e..78deb99 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -96,6 +96,7 @@ build-version.scm build-version.c buildid buildtag.h +tests/dos2unix.scm tests/thread-list.scm tests/data-structures-tests.scm tests/environment-tests.scm diff --git a/tests/dos2unix.scm b/tests/dos2unix.scm new file mode 100644 index 0000000..8bbe532 --- /dev/null +++ b/tests/dos2unix.scm @@ -0,0 +1,30 @@ +;; Cheap replacement for dos2unix + +(use data-structures extras files utils) + +(define (dos->unix file) + (let ((lines (with-input-from-file file read-lines #:binary))) + (with-output-to-file file + (lambda () + (display (string-intersperse lines "\n"))) + #:binary))) + +(define (usage #!optional exit-code) + (let ((port (if (and exit-code (not (zero? exit-code))) + (current-error-port) + (current-output-port))) + (this (pathname-strip-directory (program-name)))) + (fprintf port "Usage: ~a