Revision 4aeb2d499686beab0e66978e8719357387dc1b25 authored by Fabian R Lischka on 26 April 2017, 16:28:44 UTC, committed by Tony Kelman on 26 April 2017, 16:28:44 UTC
* add docstring to base/Dates, base/Pkg * use jldoctest, backticks, clean up, typos * add module name on first line of docstring * add space after comma in tuples (as in 0.6) * add link to ISO 8601 wikipedia
1 parent 53161af
download.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license
mktempdir() do temp_dir
# Download a file
file = joinpath(temp_dir, "ip")
@test download("http://httpbin.org/ip", file) == file
@test isfile(file)
@test !isempty(read(file))
# Download an empty file
empty_file = joinpath(temp_dir, "empty")
@test download("http://httpbin.org/status/200", empty_file) == empty_file
# Windows and older versions of curl do not create the empty file (https://github.com/curl/curl/issues/183)
@test !isfile(empty_file) || isempty(read(empty_file))
# Make sure that failed downloads do not leave files around
missing_file = joinpath(temp_dir, "missing")
@test_throws ErrorException download("http://httpbin.org/status/404", missing_file)
@test !isfile(missing_file)
# Use a TEST-NET (192.0.2.0/24) address which shouldn't be bound
invalid_host_file = joinpath(temp_dir, "invalid_host")
@test_throws ErrorException download("http://192.0.2.1", invalid_host_file)
@test !isfile(invalid_host_file)
end
Computing file changes ...