File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function loadfile(T, file::File)
9
9
end
10
10
11
11
function loadfile (T, file:: TextFile )
12
- replace (read (file. filename, String), " \r " => " " )
12
+ replace (read (file. filename, String), " \r " => " " ) # ignore CRLF/LF difference
13
13
end
14
14
15
15
function loadfile (:: Type{<:Number} , file:: File{format"TXT"} )
@@ -46,7 +46,7 @@ Convert `x` to a validate content for file data format `T`.
46
46
_convert (:: Type{<:DataFormat} , x; kw... ) = x
47
47
48
48
# plain TXT
49
- _convert (:: Type{DataFormat{:TXT}} , x; kw... ) = string (x)
49
+ _convert (:: Type{DataFormat{:TXT}} , x; kw... ) = replace ( string (x), " \r " => " " ) # ignore CRLF/LF difference
50
50
_convert (:: Type{DataFormat{:TXT}} , x:: Number ; kw... ) = x
51
51
function _convert (:: Type{DataFormat{:TXT}} , x:: AbstractArray{<:AbstractString} ; kw... )
52
52
return join (x, ' \n ' )
Original file line number Diff line number Diff line change 57
57
@test_reference " references/string3.txt" 1338 by= (ref, x)-> isapprox (ref, x; atol= 10 )
58
58
@test_reference " references/string4.txt" strip_summary (@io2str show (:: IO , MIME " text/plain" (), Int64 .(collect (1 : 5 ))))
59
59
60
+ # ignore CRLF/LF differences
61
+ @test_reference " references/string5.txt" """
62
+ This is a\r
63
+ multiline string that does not end with a new line."""
60
64
@test_reference " references/string5.txt" """
61
65
This is a
62
66
multiline string that does not end with a new line."""
You can’t perform that action at this time.
0 commit comments