@@ -18,18 +18,18 @@ isequaldlm(m1, m2, t) = isequal(m1, m2) && (eltype(m1) == eltype(m2) == t)
18
18
@test isequaldlm (readdlm (IOBuffer (" 1\t 2\n 3\t 4\n 5\t 6\n " )), [1. 2 ; 3 4 ; 5 6 ], Float64)
19
19
@test isequaldlm (readdlm (IOBuffer (" 1\t 2\n 3\t 4\n 5\t 6\n " ), Int), [1 2 ; 3 4 ; 5 6 ], Int)
20
20
21
- @test size (readcsv (IOBuffer (" 1,2,3,4" ))) == (1 ,4 )
22
- @test size (readcsv (IOBuffer (" 1,2,3," ))) == (1 ,4 )
23
- @test size (readcsv (IOBuffer (" 1,2,3,4\n " ))) == (1 ,4 )
24
- @test size (readcsv (IOBuffer (" 1,2,3,\n " ))) == (1 ,4 )
25
- @test size (readcsv (IOBuffer (" 1,2,3,4\n 1,2,3,4" ))) == (2 ,4 )
26
- @test size (readcsv (IOBuffer (" 1,2,3,4\n 1,2,3," ))) == (2 ,4 )
27
- @test size (readcsv (IOBuffer (" 1,2,3,4\n 1,2,3" ))) == (2 ,4 )
28
-
29
- @test size (readcsv (IOBuffer (" 1,2,3,4\r\n " ))) == (1 ,4 )
30
- @test size (readcsv (IOBuffer (" 1,2,3,4\r\n 1,2,3\r\n " ))) == (2 ,4 )
31
- @test size (readcsv (IOBuffer (" 1,2,3,4\r\n 1,2,3,4\r\n " ))) == (2 ,4 )
32
- @test size (readcsv (IOBuffer (" 1,2,3,\" 4\"\r\n 1,2,3,4\r\n " ))) == (2 ,4 )
21
+ @test size (readdlm (IOBuffer (" 1,2,3,4" ), ' , ' )) == (1 ,4 )
22
+ @test size (readdlm (IOBuffer (" 1,2,3," ), ' , ' )) == (1 ,4 )
23
+ @test size (readdlm (IOBuffer (" 1,2,3,4\n " ), ' , ' )) == (1 ,4 )
24
+ @test size (readdlm (IOBuffer (" 1,2,3,\n " ), ' , ' )) == (1 ,4 )
25
+ @test size (readdlm (IOBuffer (" 1,2,3,4\n 1,2,3,4" ), ' , ' )) == (2 ,4 )
26
+ @test size (readdlm (IOBuffer (" 1,2,3,4\n 1,2,3," ), ' , ' )) == (2 ,4 )
27
+ @test size (readdlm (IOBuffer (" 1,2,3,4\n 1,2,3" ), ' , ' )) == (2 ,4 )
28
+
29
+ @test size (readdlm (IOBuffer (" 1,2,3,4\r\n " ), ' , ' )) == (1 ,4 )
30
+ @test size (readdlm (IOBuffer (" 1,2,3,4\r\n 1,2,3\r\n " ), ' , ' )) == (2 ,4 )
31
+ @test size (readdlm (IOBuffer (" 1,2,3,4\r\n 1,2,3,4\r\n " ), ' , ' )) == (2 ,4 )
32
+ @test size (readdlm (IOBuffer (" 1,2,3,\" 4\"\r\n 1,2,3,4\r\n " ), ' , ' )) == (2 ,4 )
33
33
34
34
@test size (readdlm (IOBuffer (" 1 2 3 4\n 1 2 3" ))) == (2 ,4 )
35
35
@test size (readdlm (IOBuffer (" 1\t 2 3 4\n 1 2 3" ))) == (2 ,4 )
@@ -73,11 +73,11 @@ let result1 = reshape(Any["t", "c", "", "c"], 2, 2),
73
73
@test isequaldlm (readdlm (IOBuffer (" t t \n\"\"\" c\" c" )), result2, Any)
74
74
end
75
75
76
- @test isequaldlm (readcsv (IOBuffer (" \n 1,2,3\n 4,5,6\n\n\n " ), skipblanks= false ),
76
+ @test isequaldlm (readdlm (IOBuffer (" \n 1,2,3\n 4,5,6\n\n\n " ), ' , ' , skipblanks= false ),
77
77
reshape (Any[" " ,1.0 ,4.0 ," " ," " ," " ,2.0 ,5.0 ," " ," " ," " ,3.0 ,6.0 ," " ," " ], 5 , 3 ), Any)
78
- @test isequaldlm (readcsv (IOBuffer (" \n 1,2,3\n 4,5,6\n\n\n " ), skipblanks= true ), reshape ([1.0 ,4.0 ,2.0 ,5.0 ,3.0 ,6.0 ], 2 , 3 ), Float64)
79
- @test isequaldlm (readcsv (IOBuffer (" 1,2\n\n 4,5" ), skipblanks= false ), reshape (Any[1.0 ," " ,4.0 ,2.0 ," " ,5.0 ], 3 , 2 ), Any)
80
- @test isequaldlm (readcsv (IOBuffer (" 1,2\n\n 4,5" ), skipblanks= true ), reshape ([1.0 ,4.0 ,2.0 ,5.0 ], 2 , 2 ), Float64)
78
+ @test isequaldlm (readdlm (IOBuffer (" \n 1,2,3\n 4,5,6\n\n\n " ), ' , ' , skipblanks= true ), reshape ([1.0 ,4.0 ,2.0 ,5.0 ,3.0 ,6.0 ], 2 , 3 ), Float64)
79
+ @test isequaldlm (readdlm (IOBuffer (" 1,2\n\n 4,5" ), ' , ' , skipblanks= false ), reshape (Any[1.0 ," " ,4.0 ,2.0 ," " ,5.0 ], 3 , 2 ), Any)
80
+ @test isequaldlm (readdlm (IOBuffer (" 1,2\n\n 4,5" ), ' , ' , skipblanks= true ), reshape ([1.0 ,4.0 ,2.0 ,5.0 ], 2 , 2 ), Float64)
81
81
82
82
let x = bitrand (5 , 10 ), io = IOBuffer ()
83
83
writedlm (io, x)
88
88
let x = [1 ,2 ,3 ], y = [4 ,5 ,6 ], io = IOBuffer ()
89
89
writedlm (io, zip (x,y), " , " )
90
90
seek (io, 0 )
91
- @test readcsv (io) == [x y]
91
+ @test readdlm (io, ' , ' ) == [x y]
92
92
end
93
93
94
94
let x = [0.1 0.3 0.5 ], io = IOBuffer ()
@@ -100,13 +100,13 @@ end
100
100
let x = [0.1 0.3 0.5 ], io = IOBuffer ()
101
101
writedlm (io, x, " , " )
102
102
seek (io, 0 )
103
- @test readcsv (io) == [0.1 0.3 0.5 ]
103
+ @test readdlm (io, ' , ' ) == [0.1 0.3 0.5 ]
104
104
end
105
105
106
106
let x = [" abc" , " def\" ghi" , " jk\n l" ], y = [1 , " ," , " \" quoted\" " ], io = IOBuffer ()
107
107
writedlm (io, zip (x,y), ' ,' )
108
108
seek (io, 0 )
109
- @test readcsv (io) == [x y]
109
+ @test readdlm (io, ' , ' ) == [x y]
110
110
end
111
111
112
112
let x = [" a" " b" ; " d" " " ], io = IOBuffer ()
@@ -124,12 +124,12 @@ let x = ["\"hello\"", "world\""], io = IOBuffer()
124
124
end
125
125
126
126
# test comments
127
- @test isequaldlm (readcsv (IOBuffer (" #this is comment\n 1,2,3\n #one more comment\n 4,5,6" )), [1. 2. 3. ;4. 5. 6. ], Float64)
128
- @test isequaldlm (readcsv (IOBuffer (" #this is \n #comment\n 1,2,3\n #one more \n #comment\n 4,5,6" )), [1. 2. 3. ;4. 5. 6. ], Float64)
129
- @test isequaldlm (readcsv (IOBuffer (" 1,2,#3\n 4,5,6" )), [1. 2. " " ;4. 5. 6. ], Any)
130
- @test isequaldlm (readcsv (IOBuffer (" 1#,2,3\n 4,5,6" )), [1. " " " " ;4. 5. 6. ], Any)
131
- @test isequaldlm (readcsv (IOBuffer (" 1,2,\" #3\"\n 4,5,6" )), [1. 2. " #3" ;4. 5. 6. ], Any)
132
- @test isequaldlm (readcsv (IOBuffer (" 1,2,3\n #with leading whitespace\n 4,5,6" )), [1. 2. 3. ;" " " " " " ;4. 5. 6. ], Any)
127
+ @test isequaldlm (readdlm (IOBuffer (" #this is comment\n 1,2,3\n #one more comment\n 4,5,6" ), ' , ' ), [1. 2. 3. ;4. 5. 6. ], Float64)
128
+ @test isequaldlm (readdlm (IOBuffer (" #this is \n #comment\n 1,2,3\n #one more \n #comment\n 4,5,6" ), ' , ' ), [1. 2. 3. ;4. 5. 6. ], Float64)
129
+ @test isequaldlm (readdlm (IOBuffer (" 1,2,#3\n 4,5,6" ), ' , ' ), [1. 2. " " ;4. 5. 6. ], Any)
130
+ @test isequaldlm (readdlm (IOBuffer (" 1#,2,3\n 4,5,6" ), ' , ' ), [1. " " " " ;4. 5. 6. ], Any)
131
+ @test isequaldlm (readdlm (IOBuffer (" 1,2,\" #3\"\n 4,5,6" ), ' , ' ), [1. 2. " #3" ;4. 5. 6. ], Any)
132
+ @test isequaldlm (readdlm (IOBuffer (" 1,2,3\n #with leading whitespace\n 4,5,6" ), ' , ' ), [1. 2. 3. ;" " " " " " ;4. 5. 6. ], Any)
133
133
134
134
# test skipstart
135
135
let x = [" a" " b" " c" ; " d" " e" " f" ; " g" " h" " i" ; " A" " B" " C" ; 1 2 3 ; 4 5 6 ; 7 8 9 ], io = IOBuffer ()
@@ -213,21 +213,21 @@ let i18n_data = ["Origin (English)", "Name (English)", "Origin (Native)", "Name
213
213
i18n_arr = permutedims (reshape (i18n_data, 4 , Int (floor (length (i18n_data)/ 4 ))), [2 , 1 ])
214
214
i18n_buff = PipeBuffer ()
215
215
writedlm (i18n_buff, i18n_arr, ' ,' )
216
- @test i18n_arr == readcsv (i18n_buff)
216
+ @test i18n_arr == readdlm (i18n_buff, ' , ' )
217
217
218
218
hdr = i18n_arr[1 : 1 , :]
219
219
data = i18n_arr[2 : end , :]
220
220
writedlm (i18n_buff, i18n_arr, ' ,' )
221
- @test (data, hdr) == readcsv (i18n_buff, header= true )
221
+ @test (data, hdr) == readdlm (i18n_buff, ' , ' , header= true )
222
222
223
223
writedlm (i18n_buff, i18n_arr, ' \t ' )
224
224
@test (data, hdr) == readdlm (i18n_buff, ' \t ' , header= true )
225
225
end
226
226
227
- @test isequaldlm (readcsv (IOBuffer (" 1,22222222222222222222222222222222222222,0x3,10e6\n 2000.1,true,false,-10.34" ), Any),
227
+ @test isequaldlm (readdlm (IOBuffer (" 1,22222222222222222222222222222222222222,0x3,10e6\n 2000.1,true,false,-10.34" ), ' , ' , Any),
228
228
reshape (Any[1 ,2000.1 ,Float64 (22222222222222222222222222222222222222 ),true ,0x3 ,false ,10e6 ,- 10.34 ], 2 , 4 ), Any)
229
229
230
- @test isequaldlm (readcsv (IOBuffer (" -9223355253176920979,9223355253176920979" ), Int64), Int64[- 9223355253176920979 9223355253176920979 ], Int64)
230
+ @test isequaldlm (readdlm (IOBuffer (" -9223355253176920979,9223355253176920979" ), ' , ' , Int64), Int64[- 9223355253176920979 9223355253176920979 ], Int64)
231
231
232
232
# fix #13028
233
233
for data in [" A B C" , " A B C\n " ]
@@ -253,13 +253,13 @@ for writefunc in ((io,x) -> show(io, "text/csv", x),
253
253
let x = [(1 ,2 ), (3 ,4 )], io = IOBuffer ()
254
254
writefunc (io, x)
255
255
seek (io, 0 )
256
- @test readcsv (io) == [1 2 ; 3 4 ]
256
+ @test readdlm (io, ' , ' ) == [1 2 ; 3 4 ]
257
257
end
258
258
# vectors of strings:
259
259
let x = [" foo" , " bar" ], io = IOBuffer ()
260
260
writefunc (io, x)
261
261
seek (io, 0 )
262
- @test vec (readcsv (io)) == x
262
+ @test vec (readdlm (io, ' , ' )) == x
263
263
end
264
264
end
265
265
@@ -275,12 +275,12 @@ end
275
275
276
276
# issue #21180
277
277
let data = " \" 721\" ,\" 1438\" ,\" 1439\" ,\" …\" ,\" 1\" "
278
- @test readcsv (IOBuffer (data)) == Any[721 1438 1439 " …" 1 ]
278
+ @test readdlm (IOBuffer (data), ' , ' ) == Any[721 1438 1439 " …" 1 ]
279
279
end
280
280
281
281
# issue #21207
282
282
let data = " \" 1\" ,\" 灣\"\" 灣灣灣灣\" ,\" 3\" "
283
- @test readcsv (IOBuffer (data)) == Any[1 " 灣\" 灣灣灣灣" 3 ]
283
+ @test readdlm (IOBuffer (data), ' , ' ) == Any[1 " 灣\" 灣灣灣灣" 3 ]
284
284
end
285
285
286
286
# issue #11484: useful error message for invalid readdlm filepath arguments
0 commit comments