Skip to content

Commit 7a8b810

Browse files
committed
add test for .rds file format and a test file
1 parent 3a0c3a8 commit 7a8b810

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

test/files/minimal_ascii.rds

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
A
2+
2
3+
197634
4+
131840
5+
787
6+
1
7+
14
8+
2
9+
1.1
10+
2.2
11+
1026
12+
1
13+
262153
14+
5
15+
names
16+
16
17+
1
18+
262153
19+
3
20+
num
21+
1026
22+
1
23+
262153
24+
9
25+
row.names
26+
13
27+
2
28+
NA
29+
-2
30+
1026
31+
1
32+
262153
33+
5
34+
class
35+
16
36+
1
37+
262153
38+
10
39+
data.frame
40+
254

test/query.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,16 @@ end
319319
@test (position(io) in (5, 6))
320320
end
321321
end
322+
@testset "RDS detection" begin
323+
q = query(joinpath(file_dir, "minimal_ascii.rds"))
324+
@test typeof(q) == File{format"RDataSingle"}
325+
open(q) do io
326+
@test position(io) == 0
327+
@test FileIO.detect_rdata_single(io)
328+
# need to seek to beginning of file where data structure starts
329+
@test position(io) == 0
330+
end
331+
end
322332
@testset "Format with function for magic bytes" begin
323333
add_format(format"FUNCTION_FOR_MAGIC_BYTES", x -> 0x00, ".wav", [:WAV])
324334
del_format(format"FUNCTION_FOR_MAGIC_BYTES")

0 commit comments

Comments
 (0)