From 32410ebca75ec1155372a3c109fa7c18336ae75e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 11 Apr 2020 23:57:49 -0500 Subject: [PATCH] Windows: Handle three places where Windows line endings break the tests. 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 | 7 ++++++- core/checksums/checksums-docs.factor | 4 +++- extra/benchmark/regex-dna/regex-dna-tests.factor | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/basis/io/streams/throwing/throwing-tests.factor b/basis/io/streams/throwing/throwing-tests.factor index 4f5f0370b6..d31b00f87c 100644 --- a/basis/io/streams/throwing/throwing-tests.factor +++ b/basis/io/streams/throwing/throwing-tests.factor @@ -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 } } [ diff --git a/core/checksums/checksums-docs.factor b/core/checksums/checksums-docs.factor index 0cd52997a6..9f33b355da 100644 --- a/core/checksums/checksums-docs.factor +++ b/core/checksums/checksums-docs.factor @@ -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 }" diff --git a/extra/benchmark/regex-dna/regex-dna-tests.factor b/extra/benchmark/regex-dna/regex-dna-tests.factor index 3290e47842..b7ae5f776d 100644 --- a/extra/benchmark/regex-dna/regex-dna-tests.factor +++ b/extra/benchmark/regex-dna/regex-dna-tests.factor @@ -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