@@ -7,6 +7,7 @@ if isdefined(Base, Symbol("@main")) && VERSION >= v"1.12.0-DEV.102"
77 r" \s +" => " " )
88 @test contains (help, " SYNOPSIS" )
99 @test contains (help, " Path to the root directory" )
10+ @test contains (help, " --test" )
1011 run1 = replace (readchomp (` $cmd --project=$(dir) -m ExplicitImports $dir ` ),
1112 r" \s +" => " " )
1213 @test contains (run1, " is not relying on any implicit imports." )
3031 r" \s +" => " " )
3132 @test contains (help, " SYNOPSIS" )
3233 @test contains (help, " Path to the root directory" )
34+ @test contains (help, " --test" )
3335 run1 = replace (readchomp (` $cmd --project=$(dir) -e "using ExplicitImports: main; exit(main([\" $(dir) \" ]))"` ),
3436 r" \s +" => " " )
3537 @test contains (run1, " is not relying on any implicit imports." )
4547 " is not a supported flag, directory, or file. See the output of `--help` for usage details" )
4648end
4749
50+ @testset " Test --test flag" begin
51+ mktempdir () do tmp
52+ proj_path = joinpath (tmp, " Project.toml" )
53+ src_dir = joinpath (tmp, " src" )
54+ mkpath (src_dir)
55+ write (proj_path,
56+ " name = \" TmpPkg\"\n " *
57+ " uuid = \" 00000000-0000-0000-0000-000000000001\"\n " *
58+ " version = \" 0.1.0\"\n " )
59+ write (joinpath (src_dir, " TmpPkg.jl" ),
60+ " module TmpPkg\n\n " *
61+ " greet() = \" hello\"\n\n " *
62+ " end # module\n " )
63+ @test ExplicitImports. main ([tmp, " --test" ]) == 0
64+ @test ExplicitImports. main ([tmp, " --test" , " --print" ]) == 0
65+ @test ExplicitImports. main ([tmp, " --test" , " --check" ]) == 1
66+ @test ExplicitImports. main ([tmp, " --test" , " --checklist" , " all" ]) == 1
67+ end
68+ end
69+
4870@testset " Test checks" begin
4971 # Expected failure on no_implicit_imports due to DataFramesExt
5072 dir = joinpath (@__DIR__ , " TestPkg" )
0 commit comments