Skip to content

Commit

Permalink
Test checks on ExplicitImports.main (#91)
Browse files Browse the repository at this point in the history
Test the checks in ExplicitImports.main.
Test the three branches for the --checklist option.

Closes #90
  • Loading branch information
abelsiqueira authored Oct 8, 2024
1 parent 6295693 commit f4d64b0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,23 @@ end
@test contains(str,
"is not a supported flag, directory, or file. See the output of `--help` for usage details")
end

if VERSION >= v"1.9-" # test only when we have package extensions, for simplicity
@testset "Test checks" begin
# Expected failure on no_implicit_imports due to DataFramesExt
dir = joinpath(@__DIR__, "TestPkg")
expected_failure = ["no_implicit_imports"]

@testset "Specific check $check" for check in ExplicitImports.CHECKS
expected = check in expected_failure ? 1 : 0
@test ExplicitImports.main([dir, "--check", "--checklist", check]) == expected
end
@testset "All checks" begin
@test ExplicitImports.main([dir, "--check", "--checklist", "all"]) == 1
end
@testset "Exclude check" begin
checks = join("exclude_" .* expected_failure, ",")
@test ExplicitImports.main([dir, "--check", "--checklist", checks]) == 0
end
end
end

0 comments on commit f4d64b0

Please sign in to comment.