Skip to content

Commit

Permalink
Fix depwarn and error on 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Jan 12, 2017
1 parent c20c25f commit d1b8eba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/loadsave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ save(s::@compat(Union{AbstractString,IO}), data...; options...) =
function save{sym}(df::Type{DataFormat{sym}}, f::AbstractString, data...; options...)
libraries = applicable_savers(df)
checked_import(libraries[1])
save(File(DataFormat{sym}, f), data...; options...)
eval(Main, :($save($File($(DataFormat{sym}), $f),
$data...; $options...)))
end

function save{sym}(df::Type{DataFormat{sym}}, s::IO, data...; options...)
libraries = applicable_savers(df)
checked_import(libraries[1])
save(Stream(DataFormat{sym}, s), data...; options...)
eval(Main, :($save($Stream($(DataFormat{sym}), $s),
$data...; $options...)))
end


Expand All @@ -82,7 +84,7 @@ function load{F}(q::Formatted{F}, args...; options...)
if !has_method_from(methods(Library.load), Library)
throw(LoaderError(string(library), "load not defined"))
end
return Library.load(q, args...; options...)
return eval(Main, :($(Library.load)($q, $args...; $options...)))
catch e
push!(failures, (e, q))
end
Expand All @@ -99,7 +101,7 @@ function save{F}(q::Formatted{F}, data...; options...)
if !has_method_from(methods(Library.save), Library)
throw(WriterError(string(library), "save not defined"))
end
return Library.save(q, data...; options...)
return eval(Main, :($(Library.save)($q, $data...; $options...)))
catch e
push!(failures, (e, q))
end
Expand Down
3 changes: 2 additions & 1 deletion test/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ else
const Test = BaseTestNext
end
using Compat
import Compat.String

if VERSION < v"0.4.0-dev"
import FileIO.Pair
Expand Down Expand Up @@ -134,7 +135,7 @@ try
@test isnull(file_extension(q))

# File with correct extension
str = takebuf_string(io)
str = String(take!(io))
fn = string(tempname(), ".jnk")
open(fn, "w") do file
write(file, str)
Expand Down

0 comments on commit d1b8eba

Please sign in to comment.