Ai
21 Star 49 Fork 0

Gitee 极速下载/julia-language

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/JuliaLang/julia
克隆/下载
embedding-test.jl 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
# This file is a part of Julia. License is MIT: https://julialang.org/license
# tests the output of the embedding example is correct
using Test
if Sys.iswindows()
# libjulia needs to be in the same directory as the embedding executable or in path
ENV["PATH"] = string(Sys.BINDIR, ";", ENV["PATH"])
end
@test length(ARGS) == 1
@testset "embedding example" begin
out = Pipe()
err = Pipe()
embedded_cmd_path = abspath(ARGS[1])
p = cd(@__DIR__) do
run(pipeline(Cmd([embedded_cmd_path]), stdin=devnull, stdout=out, stderr=err), wait=false)
end
close(out.in)
close(err.in)
out_task = @async readlines(out)
@test readline(err) == "MethodError: no method matching this_function_has_no_methods()"
@test readline(err) == "The function `this_function_has_no_methods` exists, but no method is defined for this combination of argument types."
@test success(p)
lines = fetch(out_task)
@test length(lines) == 11
@test parse(Float64, lines[1]) sqrt(2)
@test lines[2] == "sqrt(2.0) in C: 1.414214e+00"
@test lines[3] == "sqrt(2.0) in C: 1.414214e+00"
@test lines[4] == "sqrt(2.0) in C: 1.414214e+00"
@test lines[9] == "called bar"
@test lines[10] == "calling new bar"
@test lines[11] == " From worker 2:\tTaking over the world..."
@test "exception caught from C" in readlines(err)
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/mirrors/julia-language.git
git@gitee.com:mirrors/julia-language.git
mirrors
julia-language
julia-language
master

搜索帮助