Skip to content

Commit

Permalink
simplify jet tests (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov authored Sep 12, 2024
1 parent 4f32aad commit dc12196
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,15 @@ using ConcurrentSim
using JET
using Test

using JET: ReportPass, BasicPass, InferenceErrorReport, UncaughtExceptionReport

using InteractiveUtils

# Custom report pass that ignores `UncaughtExceptionReport`
# Too coarse currently, but it serves to ignore the various
# "may throw" messages for runtime errors we raise on purpose
# (mostly on malformed user input)
struct MayThrowIsOk <: ReportPass end

# ignores `UncaughtExceptionReport` analyzed by `JETAnalyzer`
(::MayThrowIsOk)(::Type{UncaughtExceptionReport}, @nospecialize(_...)) = return

# forward to `BasicPass` for everything else
function (::MayThrowIsOk)(report_type::Type{<:InferenceErrorReport}, @nospecialize(args...))
BasicPass()(report_type, args...)
end

@testset "JET checks" begin
rep = report_package("ConcurrentSim";
report_pass=MayThrowIsOk(),
ignored_modules=(
AnyFrameModule(InteractiveUtils),
)
)
@show rep
@test_broken length(JET.get_reports(rep)) == 0
@test length(JET.get_reports(rep)) <= 4
@test length(JET.get_reports(rep)) <= 3
end

0 comments on commit dc12196

Please sign in to comment.