Skip to content

Commit ca31d6b

Browse files
committed
oops... let's get more tests!
1 parent c80a34e commit ca31d6b

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/ReTest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ function process_args(@nospecialize(args);
13361336
# if a parent module with no tests is explicitly passed, which contains a submodule
13371337
# and recursive==true, then the submodule name is printed (and similarly for
13381338
# printing `MyPackageTests` when `MyPackage` is passed and `load==true`)
1339-
module_header = length(modules) > 1 | implicitmodules
1339+
module_header = (length(modules) > 1) | implicitmodules
13401340

13411341
# remove modules which don't have tests, which can happen when a parent module without
13421342
# tests is passed to retest in order to run tests in its submodules

test/runtests.jl

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,35 @@ end
5858

5959
innertestsets = ["d", "e1", "e2", "g", "h1", "h2"]
6060

61-
function check(rx, list)
61+
function check(rx, list; implicit=false)
6262
empty!(RUN)
63-
retest(M, Regex(rx))
63+
if implicit
64+
retest(Regex(rx))
65+
else
66+
retest(M, Regex(rx))
67+
end
6468
@test RUN == list
6569
mktemp() do path, io
6670
redirect_stdout(io) do
67-
retest(M, Regex(rx), dry=true, id=false) # TODO: test with id=true
71+
if implicit
72+
retest(Regex(rx), dry=true, id=false)
73+
else
74+
retest(M, Regex(rx), dry=true, id=false) # TODO: test with id=true
75+
end
6876
end
6977
seekstart(io)
7078
expected = map(list) do t
71-
if t in innertestsets
72-
" " * t * ""
73-
else
74-
t * ""
75-
end
79+
" "^implicit *
80+
if t in innertestsets
81+
" " * t * ""
82+
else
83+
t * ""
84+
end
7685
end
7786
expected = join(expected, '\n')
87+
if implicit
88+
expected = "Main.M\n" * expected
89+
end
7890
actual = readchomp(io)
7991
if isempty(expected)
8092
@test startswith(actual, "No matching tests for module")
@@ -85,6 +97,10 @@ function check(rx, list)
8597
end
8698
end #
8799

100+
@chapter OnlyOneModule begin
101+
M.check("a", ["a"], implicit=true)
102+
end
103+
88104
@chapter M begin
89105
# we don't put these checks in a @testset, as this would modify filtering logic
90106
# (e.g. with `@testset "filtering" ...`, testset subjects would start with "/filtering/...")

0 commit comments

Comments
 (0)