Skip to content

Commit

Permalink
Merge pull request #138 from JuliaIO/sd/fix137
Browse files Browse the repository at this point in the history
Sd/fix137
  • Loading branch information
SimonDanisch committed Jul 3, 2017
2 parents 34ad95d + 41c90ed commit 2f77c74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/loadsave.jl
Expand Up @@ -21,7 +21,12 @@ for (applicable_, add_, dict_) in (
(:applicable_loaders, :add_loader, :sym2loader),
(:applicable_savers, :add_saver, :sym2saver))
@eval begin
$applicable_{sym}(::Union{Type{DataFormat{sym}}, Formatted{DataFormat{sym}}}) = get($dict_, sym, [:FileIO]) # if no loader is declared, fallback to FileIO
function $applicable_{sym}(::Union{Type{DataFormat{sym}}, Formatted{DataFormat{sym}}})
if haskey($dict_, sym)
return $dict_[sym]
end
error("No $($applicable_) found for $(sym)")
end
function $add_{sym}(::Type{DataFormat{sym}}, pkg::Symbol)
list = get($dict_, sym, Symbol[])
$dict_[sym] = push!(list, pkg)
Expand Down
3 changes: 2 additions & 1 deletion test/query.jl
Expand Up @@ -316,7 +316,8 @@ end
open(q) do io
@test position(io) == 0
@test FileIO.detect_rdata(io)
@test position(io) == 5
# 6 for /r/n and 5 for /n
@test (position(io) in (5, 6))
end
end
@testset "Format with function for magic bytes" begin
Expand Down

0 comments on commit 2f77c74

Please sign in to comment.