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
master
Doug Coleman 2020-04-11 23:57:49 -05:00
parent 2b85b27c17
commit 32410ebca7
3 changed files with 12 additions and 3 deletions

View 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 } } [

View 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 }"

View 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