21 Star 49 Fork 0

Gitee 极速下载/julia-language

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/JuliaLang/julia
克隆/下载
download_exec.jl 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
# This file is a part of Julia. License is MIT: https://julialang.org/license
module TestDownload
using Test
mktempdir() do temp_dir
# Download a file
file = joinpath(temp_dir, "ip")
@test download("https://httpbin.julialang.org/ip", file) == file
@test isfile(file)
@test !isempty(read(file))
ip = read(file, String)
# Download an empty file
empty_file = joinpath(temp_dir, "empty")
@test download("https://httpbin.julialang.org/status/200", empty_file) == empty_file
@test isfile(empty_file)
@test isempty(read(empty_file))
# Make sure that failed downloads do not leave files around
missing_file = joinpath(temp_dir, "missing")
@test_throws Exception download("https://httpbin.julialang.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 Exception download("http://192.0.2.1", invalid_host_file)
@test !isfile(invalid_host_file)
end
end # module
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/mirrors/julia-language.git
git@gitee.com:mirrors/julia-language.git
mirrors
julia-language
julia-language
master

搜索帮助