Skip to content

Commit

Permalink
remove unnecessary catch clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jan 16, 2024
1 parent 9b56ddc commit 69bf5ab
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
2 changes: 0 additions & 2 deletions test/test_misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ end

Pkg.activate(; temp=true, io=devnull)
@test_throws ErrorException find_pkg(nothing)
catch err
rethrow(err)
finally
Pkg.activate(old; io=devnull)
end
Expand Down
62 changes: 29 additions & 33 deletions test/toplevel/test_virtualprocess.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1479,44 +1479,40 @@ end

# NOTE better to be in test_misc.jl, but here it is since this test is only valid when the testset above gets passed
@testset "configuration file" begin
dir = mktempdir()
analysis_target = normpath(dir, "concretization_patterns.jl")
config_target = normpath(dir, JET.CONFIG_FILE_NAME)
mktempdir() do dir
analysis_target = normpath(dir, "concretization_patterns.jl")
config_target = normpath(dir, JET.CONFIG_FILE_NAME)

back = pwd()
try
# in order to check the functionality, fixtures/..JET.toml logs toplevel analysis
# into toplevel.txt (relative to the current working directory)
# and so let's `cd` into the temporary directory to not pollute this directory
cd(dir)
back = pwd()
try # in order to check the functionality, fixtures/..JET.toml logs toplevel analysis
# into toplevel.txt (relative to the current working directory)
# and so let's `cd` into the temporary directory to not pollute this directory
cd(dir)

open(CONCRETIZATION_PATTERNS_FILE) do f
write(analysis_target, f)
end
open(CONCRETIZATION_PATTERNS_FILE) do f
write(analysis_target, f)
end

# no configuration, thus top-level analysis should fail
let
res = report_file2(analysis_target)
nreported = print_reports(IOBuffer(), res)
@test !iszero(nreported) # error reported
end
# no configuration, thus top-level analysis should fail
let res = report_file2(analysis_target)
nreported = print_reports(IOBuffer(), res)
@test !iszero(nreported) # error reported
end

# setup a configuration file
open(CONCRETIZATION_PATTERNS_CONFIG) do f
write(config_target, f)
end
# setup a configuration file
open(CONCRETIZATION_PATTERNS_CONFIG) do f
write(config_target, f)
end

# now any top-level analysis failure shouldn't happen
let
res = report_file2(analysis_target)
nreported = print_reports(IOBuffer(), res)
@test iszero(nreported) # no error happened
@test isfile("toplevel.txt") # not closed yet
end
catch err
rethrow(err)
finally
cd(back)
# now any top-level analysis failure shouldn't happen
let res = report_file2(analysis_target)
nreported = print_reports(IOBuffer(), res)
@test iszero(nreported) # no error happened
@test isfile("toplevel.txt") # not closed yet
end
finally
cd(back)
end
end
end

Expand Down

0 comments on commit 69bf5ab

Please sign in to comment.