-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.jl
87 lines (79 loc) · 2.56 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using Run
using Run: Result, Failed
using Pkg
using Test
pass_script = joinpath(@__DIR__, "pass", "pass.jl")
fail_script = joinpath(@__DIR__, "fail", "fail.jl")
depwarn_no_script = joinpath(@__DIR__, "depwarn-no", "test.jl")
depwarn_yes_script = joinpath(@__DIR__, "depwarn-yes", "test.jl")
depwarn_error_script = joinpath(@__DIR__, "depwarn-error", "test.jl")
@testset "xfail" begin
@testset "true pass" begin
result = nothing
@test begin
result = Run.test(pass_script)
end isa Result
@test result.proc.exitcode == 0
@test sprint(show, "text/plain", result) isa String
end
@testset "true failure" begin
err = nothing
@test try
Run.test(fail_script)
false
catch err
true
end
@test err.result.proc.exitcode == 1
@test sprint(show, "text/plain", err) isa String
end
@testset "expected failure" begin
result = nothing
@test begin
result = Run.test(fail_script; xfail = true)
end isa Result
@test result.proc.exitcode == 1
@test sprint(show, "text/plain", result) isa String
@test sprint(showerror, result) isa String
end
@testset "unexpected pass" begin
err = nothing
@test try
Run.test(pass_script; xfail = true)
false
catch err
true
end
@test err.result.proc.exitcode == 0
@test sprint(show, "text/plain", err) isa String
@test sprint(showerror, err) isa String
end
end
@testset "depwarn" begin
@test Run.test(depwarn_yes_script).proc.exitcode == 0
@test Run.test(depwarn_yes_script; depwarn = false, xfail = true).proc.exitcode == 1
@test Run.test(depwarn_no_script; depwarn = false).proc.exitcode == 0
@test Run.test(depwarn_error_script; depwarn = :error).proc.exitcode == 0
end
@testset "smoke test" begin
withenv("DOCUMENTER_KEY" => nothing) do
@test Run.docs(joinpath(@__DIR__, "..", "docs")) isa Any
end
pkgspec = PackageSpec(
name = "InitialValues",
url = "https://github.com/tkf/InitialValues.jl",
rev = "62b240fb85836b9731b0a893e446a9c90311afce",
)
@test Run.test(pkgspec) isa Any
@test Run.test(pkgspec; inline=false) isa Any
pkgid = Base.PkgId(
Base.UUID("22cec73e-a1b8-11e9-2c92-598750a2cf9c"),
"InitialValues",
)
mktempdir() do project
Run.temporaryactivating(project) do
Pkg.add(pkgspec)
Run.versioninfo(stdout, pkgid)
end
end
end