Skip to content

Commit

Permalink
Compat for Serialization stdlib (#473)
Browse files Browse the repository at this point in the history
* Compat for Serialization stdlib

* Add tests and fix
  • Loading branch information
omus authored Jan 29, 2018
1 parent ace032f commit 791ea60
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ Currently, the `@compat` macro supports the following syntaxes:
* `using Compat.REPL` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25544]).

* `using Compat.Serialization` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25628]).

## New functions, macros, and methods

* `@views` takes an expression and converts all slices to views ([#20164]), while
Expand Down Expand Up @@ -496,6 +499,7 @@ includes this fix. Find the minimum version from there.
[#25544]: https://github.com/JuliaLang/julia/issues/25544
[#25545]: https://github.com/JuliaLang/julia/issues/25545
[#25571]: https://github.com/JuliaLang/julia/issues/25571
[#25628]: https://github.com/JuliaLang/julia/issues/25628
[#25629]: https://github.com/JuliaLang/julia/issues/25629
[#25654]: https://github.com/JuliaLang/julia/issues/25654
[#24182]: https://github.com/JuliaLang/julia/issues/24182
9 changes: 9 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,15 @@ else
import REPL
end

if VERSION < v"0.7.0-DEV.3476"
@eval module Serialization
import Base.Serializer: serialize, deserialize, SerializationState
export serialize, deserialize, SerializationState
end
else
import Serialization
end

# 0.7.0-DEV.1993
@static if !isdefined(Base, :EqualTo)
if VERSION >= v"0.6.0"
Expand Down
11 changes: 11 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,17 @@ module TestREPL
@test isdefined(@__MODULE__, :REPL)
end

# 0.7.0-DEV.3476
module TestSerialization
using Compat
using Compat.Serialization
using Compat.Test
@test isdefined(@__MODULE__, :Serialization)
@test isdefined(@__MODULE__, :serialize)
@test isdefined(@__MODULE__, :deserialize)
@test isdefined(@__MODULE__, :SerializationState)
end

if VERSION < v"0.6.0"
include("deprecated.jl")
end
Expand Down

0 comments on commit 791ea60

Please sign in to comment.