Skip to content

Commit

Permalink
added tests [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy authored and JeffBezanson committed Sep 16, 2015
1 parent 3d6c872 commit 3b8d41a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion base/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ function deserialize(s::SerializationState, ::Type{Function})
f.env = deserialize(s)
return f
end

deserialize_cycle(s, f)
return f
end
Expand Down
24 changes: 21 additions & 3 deletions test/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,34 @@ create_serialization_stream() do s
end

# cycles
module CycleFoo
echo(x)=x
end
create_serialization_stream() do s
A = Any[1,2,3,4,5]
echo(x) = x
afunc = (x)->x
A = Any[1,2,3,abs,abs,afunc,afunc,echo,echo,CycleFoo.echo,CycleFoo.echo,4,5]
A[3] = A
serialize(s, A)
seekstart(s)
b = deserialize(s)
@test b[3] === b
@test b[1] == 1
@test b[5] == 5
@test length(b) == 5
@test b[4] === abs
@test b[5] === b[4]
@test b[5](-1) == 1

@test b[6] === b[7]
@test b[6]("Hello") == "Hello"

@test b[8] === b[9]
@test b[8]("World") == "World"

@test b[10] === b[11]
@test b[10]("foobar") == "foobar"

@test b[end] == 5
@test length(b) == length(A)
@test isa(b,Vector{Any})
end

Expand Down

0 comments on commit 3b8d41a

Please sign in to comment.