]> gitweb.factorcode.org Git - factor.git/commitdiff
Windows: Handle three places where Windows line endings break the tests.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 12 Apr 2020 04:57:49 +0000 (23:57 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 12 Apr 2020 05:05:44 +0000 (00:05 -0500)
Usually we check out with Unix line endings, but if you don't set this
option, then get adds extra newlines to text files. Since there are
only three places, let's just fix them.

Fixes #2276

basis/io/streams/throwing/throwing-tests.factor
core/checksums/checksums-docs.factor
extra/benchmark/regex-dna/regex-dna-tests.factor

index 4f5f0370b6687b1d2190784e5cf1328bb6c6a245..d31b00f87cd3e80f151e68977a1a1d9af0eb609c 100644 (file)
@@ -33,10 +33,15 @@ io.streams.throwing kernel namespaces tools.test ;
     "asdf" [ [ 2 read ] throw-on-eof 3 read ] with-string-reader
 ] unit-test
 
-{ "as" "df\n" } [
+{ t } [
     "vocab:io/streams/throwing/asdf.txt" utf8 [
         [ 2 read ] throw-on-eof 20 read
     ] with-file-reader
+    ! For Windows line endings
+    2array {
+        { "as" "df\n" }
+        { "as" "df\r\n" }
+    } member?
 ] unit-test
 
 { B{ 0 1 2 3 } B{ 0 1 2 3 } } [
index 0cd52997a6b223e8b08b859c2898608afb06c01c..9f33b355dadfeb442242574c6d2afc4f371040ea 100644 (file)
@@ -38,7 +38,9 @@ HELP: checksum-file
 { $values { "path" "a pathname specifier" } { "checksum" "a checksum specifier" } { "value" byte-array } }
 { $description "Computes the checksum of all data in a file." }
 { $examples
-    { $example
+    { $unchecked-example
+        ! This example fails on Windows if you ``git clone`` with Windows line-endings
+        ! Issue #2276
         "USING: checksums checksums.crc32 prettyprint ;"
         "\"resource:core/checksums/crc32/crc-me.txt\" crc32 checksum-file ."
         "B{ 196 202 117 155 }"
index 3290e47842f82ab72edcce69c483aff67bde8d9d..b7ae5f776deba23b2ae5a69b0441c4c253deb8f2 100644 (file)
@@ -5,5 +5,7 @@ io.streams.string kernel tools.test splitting ;
     "resource:extra/benchmark/regex-dna/regex-dna-test-in.txt"
     [ regex-dna ] with-string-writer
     "resource:extra/benchmark/regex-dna/regex-dna-test-out.txt"
-    ascii file-contents =
+    ! Ensure the line endings don't change on Windows
+    ! when checking out with git.
+    ascii file-lines "\n" join =
 ] unit-test