Skip to content

Commit

Permalink
test examples from JuliaIO#327
Browse files Browse the repository at this point in the history
  • Loading branch information
jw3126 committed Jun 25, 2021
1 parent c2cc6de commit 36bf062
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/loadsave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ end
@load fn tup

@test tup == (EmptyImmutable(), EmptyImmutable())

# Test for Recursively Empty struct
@save fn tup=(EmptyII(EmptyImmutable()), EmptyImmutable())
@load fn tup
Expand All @@ -293,7 +293,7 @@ end
@load fn ptr

@test ptr == Ptr{Float64}(0)

# Test for pointer inside structure
@save fn tup=(; ptr = pointer(zeros(5)))
@load fn tup
Expand All @@ -316,7 +316,7 @@ end
jldopen(fn, "r") do f
@test f["a"] == 1
@test f["b"] == 2
end
end
end

# Test for object deletion
Expand Down Expand Up @@ -385,4 +385,14 @@ end
@test a isa SingleUnionallField
@test a.x isa IdDict{Any,Any}
end


@testset "Issue #327" begin
path = tempname()
x = (1,2)
JLD2.@save path x
@test load(path, "x") === (1,2)

D = Dict("a"=>"Hazel")
JLD2.@save path D
@test load(path, "D") == D
end

0 comments on commit 36bf062

Please sign in to comment.