File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 for dir in selected_dirs
1515 isfile (joinpath (dir, " check.jl" )) || continue
1616 @info " Running integration tests for $(basename (dir)) "
17- @test success (` $(Base. julia_cmd ()) --project=$dir -e 'using Pkg; Pkg.instantiate()'` )
18- @test success (` $(Base. julia_cmd ()) --project=$dir $dir /check.jl` )
17+ run (` $(Base. julia_cmd ()) --project=$dir -e 'using Pkg; Pkg.instantiate()'` )
18+ run (` $(Base. julia_cmd ()) --project=$dir $dir /check.jl` )
1919 end
2020end
Original file line number Diff line number Diff line change 119119# figure out if `leaf` is part of an import or using statement
120120# this seems to trigger for both `X` and `y` in `using X: y`, but that seems alright.
121121function analyze_import_type (leaf)
122- kind (leaf) == K " Identifier" || return :not_import
122+ kind (leaf) in ( K " Identifier" , K " MacroName " , K " StringMacroName " ) || return :not_import
123123 has_parent (leaf) || return :not_import
124124 is_import = parents_match (leaf, (K " importpath" ,))
125125 is_import || return :not_import
Original file line number Diff line number Diff line change 1+ # https://github.com/JuliaTesting/ExplicitImports.jl/issues/97
2+ module ArgCheck
3+
4+ export @argcheck
5+
6+ macro argcheck (ex)
7+ return esc (ex)
8+ end
9+
10+ end # module
11+
12+ module Issue97
13+
14+ using .. ArgCheck
15+ using .. ArgCheck: ArgCheck, @argcheck
16+
17+ function positive (x)
18+ @argcheck x > 0
19+ return x
20+ end
21+
22+ end # module
Original file line number Diff line number Diff line change 1+ issue_path = joinpath (@__DIR__ , " issue_97.jl" )
2+ include (issue_path)
3+
4+ @testset " Issue #97: macro explicit imports" begin
5+ # Issue97 does `using ..ArgCheck` plus `using ..ArgCheck: ArgCheck, @argcheck`.
6+ # The macro is explicitly imported, so check_no_implicit_imports should pass.
7+ @test check_no_implicit_imports (Issue97, issue_path) === nothing
8+ @test check_no_stale_explicit_imports (Issue97, issue_path) === nothing
9+
10+ analysis = ExplicitImports. get_names_used (issue_path). per_usage_info
11+ argcheck_usages = filter (analysis) do nt
12+ nt. name == Symbol (" @argcheck" ) && nt. module_path == [:Issue97 ]
13+ end
14+
15+ @test getfield .(argcheck_usages, :analysis_code ) ==
16+ [ExplicitImports. IgnoredImportRHS, ExplicitImports. External]
17+ end
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ include("issue_140.jl")
109109 include (" issue_111_test.jl" )
110110 end
111111
112+ @testset " Macro explicit imports (#97)" begin
113+ include (" issue_97_test.jl" )
114+ end
115+
112116 @testset " module aliases (#106)" begin
113117 # https://github.com/JuliaTesting/ExplicitImports.jl/issues/106
114118 ret = Dict (improper_explicit_imports (ModAlias, " module_alias.jl" ))
You can’t perform that action at this time.
0 commit comments