Skip to content

Commit

Permalink
SHA,tests: cleanup tempdir (#30655)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored and JeffBezanson committed Jan 11, 2019
1 parent 8e571bb commit 1daf145
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions stdlib/SHA/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const VERBOSE = false
lorem = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
so_many_as_array = repeat([0x61], 1000000)
so_many_as_tuple = ntuple((i) -> 0x61, 1000000)
file = ".sha" # Subject to change
tempdir = mktempdir()
file = joinpath(tempdir, ".sha")
fIO = open(file, "w")
write(fIO, '\0')
close(fIO)
Expand Down Expand Up @@ -274,16 +275,24 @@ end
# test error if eltype of input is not UInt8
for f in sha_funcs
global nerrors
data = UInt32[0x23467, 0x324775]
try
f(UInt32[0x23467, 0x324775])
warn("Non-UInt8 Arrays should fail")
nerrors += 1
catch
f(data)
catch ex
if ex isa MethodError &&
ex.f === f &&
ex.args === (data,)
continue
end
rethrow()
end
warn("Non-UInt8 Arrays should fail")
nerrors += 1
end

# Clean up the I/O mess
rm(file)
rm(tempdir)

if nerrors == 0
VERBOSE && println("ALL OK")
Expand Down

0 comments on commit 1daf145

Please sign in to comment.