Skip to content

Commit

Permalink
Remove LazyTestResult
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Nov 17, 2023
1 parent a46dc4e commit 8dd3a36
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
30 changes: 0 additions & 30 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,6 @@ function askwargs(flag::Bool)
return NamedTuple()
end

struct LazyTestResult
label::String
message::String
pass::Bool
end

ispass(result::LazyTestResult) = result.pass

# Infix operator wrapping `ispass` so that the failure case is pretty-printed
(result, yes::Bool) = ispass(result)::Bool == yes

# To be shown via `@test` when failed:
function Base.show(io::IO, result::LazyTestResult)
print(io, "⟪result: ")
show(io, MIME"text/plain"(), result)
print(io, "")
end

function Base.show(io::IO, ::MIME"text/plain", result::LazyTestResult)
if ispass(result)
printstyled(io, "✔ PASS"; color = :green, bold = true)
else
printstyled(io, "😭 FAILED"; color = :red, bold = true)
end
println(io, ": ", result.label)
for line in eachline(IOBuffer(result.message))
println(io, " "^4, line)
end
end

function project_toml_path(dir)
candidates = joinpath.(dir, ["Project.toml", "JuliaProject.toml"])
i = findfirst(isfile, candidates)
Expand Down
2 changes: 1 addition & 1 deletion test/test_project_extras.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module TestProjectExtras

include("preamble.jl")
using Aqua: is_julia12_or_later, ispass,
using Aqua: is_julia12_or_later
using Base: PkgId, UUID

@testset "is_julia12_or_later" begin
Expand Down
2 changes: 1 addition & 1 deletion test/test_stale_deps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module TestStaleDeps

include("preamble.jl")
using Base: PkgId, UUID
using Aqua: find_stale_deps_2, ispass,
using Aqua: find_stale_deps_2

@testset "find_stale_deps_2" begin
pkg = PkgId(UUID(42), "TargetPkg")
Expand Down

0 comments on commit 8dd3a36

Please sign in to comment.