Skip to content

Commit

Permalink
[registry] AVS .fld data files (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffFessler authored May 15, 2021
1 parent 7228f88 commit 51a4ed9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/registry.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### "Package registry"
# Useful for packages that get used more than once below
# Please alphabetize
const idAVSfldIO = :AVSfldIO => UUID("b6189060-daf9-4c28-845a-cc0984b81781")
const idCSVFiles = :CSVFiles => UUID("5d742f6a-9f54-50ce-8119-2520741973ca")
const idImageIO = :ImageIO => UUID("82e4d734-157c-48bb-816b-45c225c6df19")
const idImageMagick = :ImageMagick => UUID("6218d12a-5da1-5696-b52f-db25d2ecc6d1")
Expand Down Expand Up @@ -81,6 +82,7 @@ end

add_format(format"RDataSingle", detect_rdata_single, [".rds"], [idRData, LOAD])

add_format(format"AVSfld", "# AVS", [".fld"], [idAVSfldIO])
add_format(format"CSV", (), [".csv"], [idCSVFiles])
add_format(format"TSV", (), [".tsv"], [idCSVFiles])
add_format(format"Feather", "FEA1", [".feather"], [:FeatherFiles => UUID("b675d258-116a-5741-b937-b79f054b0542")])
Expand Down
2 changes: 2 additions & 0 deletions test/files/avs-ascii.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 2 3 4 5 6
7 8 9 8 7 6
9 changes: 9 additions & 0 deletions test/files/avs-ascii.fld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# AVS field file (ascii variant)
ndim=2
dim1=3
dim2=4
nspace=2
veclen=1
data=int
field=uniform
variable 1 file=avs-ascii.dat filetype=ascii
6 changes: 6 additions & 0 deletions test/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ let file_dir = joinpath(@__DIR__, "files"), file_path = Path(file_dir)
@test position(io) == 4
end
end

@testset "AVSfld detection" begin
q = query(joinpath(file_dir, "avs-ascii.fld"))
@test typeof(q) <: File{format"AVSfld"}
end

end

@testset "Query from IOBuffer" begin
Expand Down

0 comments on commit 51a4ed9

Please sign in to comment.