Skip to content

Commit 22602dc

Browse files
committed
test jive/sprints
1 parent bf7970c commit 22602dc

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ keywords = ["distributed", "test"]
44
license = "MIT"
55
desc = "some useful steps in tests"
66
authors = ["WooKyoung Noh <[email protected]>"]
7-
version = "0.3.0"
7+
version = "0.3.1-DEV"
88

99
[deps]
1010
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

test/jive/runtests/testset.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ using Test
44
using Jive
55

66
total = runtests(@__DIR__, targets=["target3"], enable_distributed=false, verbose=false, testset=nothing)
7+
@test total isa Jive.Total
8+
@test total.elapsed_time >= 0
79
@test total.n_passes == 2
810

911
total = runtests(@__DIR__, targets=["target3"], enable_distributed=false, verbose=false, testset="hello")

test/jive/sprints/sprints.jl

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,43 @@ function Base.show(io::IO, mime::MIME"text/plain", foo::Foo)
1111
print(io, "()")
1212
end
1313

14-
@test endswith(string(Foo()), "test_jive_sprints.Foo()")
15-
@test sprint_plain(Foo()) == "Foo()"
16-
@test sprint_colored(Foo()) == "\e[92mFoo\e[39m()"
14+
foo = Foo()
15+
@test endswith(string(foo), "test_jive_sprints.Foo()")
16+
@test endswith(sprint(show, foo), "test_jive_sprints.Foo()")
17+
@test sprint_plain(foo) == "Foo()"
18+
@test sprint_colored(foo) == "\e[92mFoo\e[39m()"
19+
20+
@test "π" == string(pi) ==
21+
sprint(show, pi)
22+
@test "π = 3.1415926535897..." == sprint_plain(pi) ==
23+
sprint_colored(pi)
24+
for x in (pi, [1 2 3],
25+
:, sprint, Base.show)
26+
@test string(x) == sprint(show, x) != sprint_plain(x) == sprint_colored(x)
27+
end
28+
29+
for x in (:foo, "foo")
30+
@test string(x) != sprint(show, x) == sprint_plain(x) == sprint_colored(x)
31+
end
32+
33+
for x in (Foo,
34+
nothing, true, 1:3, 1:2:3,
35+
Int64, String, Tuple{}, Union{Int}, T where T,
36+
(), (1, 2, 3),
37+
(;), (; a = 1),
38+
[],
39+
)
40+
@test string(x) == sprint(show, x) == sprint_plain(x) == sprint_colored(x)
41+
end
42+
43+
if VERSION >= v"1.8"
44+
array2 = eval(Meta.parse("""[;;]""")) # [;;]
45+
array3 = eval(Meta.parse("""[;;;]""")) # [;;;]
46+
for x in (array2, array3)
47+
@test string(x) == sprint(show, x) != sprint_plain(x) == sprint_colored(x)
48+
end
49+
x = eval(Meta.parse("""[;]""")) # [;]
50+
@test string(x) == sprint(show, x) == sprint_plain(x) == sprint_colored(x)
51+
end
1752

1853
end # module test_jive_sprints

0 commit comments

Comments
 (0)