Skip to content

Commit 2f77c74

Browse files
authored
Merge pull request #138 from JuliaIO/sd/fix137
Sd/fix137
2 parents 34ad95d + 41c90ed commit 2f77c74

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/loadsave.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ for (applicable_, add_, dict_) in (
2121
(:applicable_loaders, :add_loader, :sym2loader),
2222
(:applicable_savers, :add_saver, :sym2saver))
2323
@eval begin
24-
$applicable_{sym}(::Union{Type{DataFormat{sym}}, Formatted{DataFormat{sym}}}) = get($dict_, sym, [:FileIO]) # if no loader is declared, fallback to FileIO
24+
function $applicable_{sym}(::Union{Type{DataFormat{sym}}, Formatted{DataFormat{sym}}})
25+
if haskey($dict_, sym)
26+
return $dict_[sym]
27+
end
28+
error("No $($applicable_) found for $(sym)")
29+
end
2530
function $add_{sym}(::Type{DataFormat{sym}}, pkg::Symbol)
2631
list = get($dict_, sym, Symbol[])
2732
$dict_[sym] = push!(list, pkg)

test/query.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ end
316316
open(q) do io
317317
@test position(io) == 0
318318
@test FileIO.detect_rdata(io)
319-
@test position(io) == 5
319+
# 6 for /r/n and 5 for /n
320+
@test (position(io) in (5, 6))
320321
end
321322
end
322323
@testset "Format with function for magic bytes" begin

0 commit comments

Comments
 (0)