Skip to content

Commit 8a5c214

Browse files
committed
Add a test that methods are not overwritten in test modules
1 parent 61b5294 commit 8a5c214

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/runtests.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
# If present, the tests run only those submodules defined above. `General` is
2323
# not a submodule, but it runs all of the top-level tests in MOI.
2424

25+
import Test
26+
2527
# This file gets called first. If it doesn't crash, all is well.
2628
include("issue980.jl")
2729

@@ -32,7 +34,14 @@ MODULES_TO_TEST = get(
3234
)
3335

3436
for submodule in split(MODULES_TO_TEST, ";")
35-
include("$(submodule)/runtests.jl")
37+
# This `test_nowarn` checks for warnings that get thrown when we include a
38+
# method twice by mistake:
39+
# WARNING: Method definition test_foo() in module TestFoo
40+
# These warnings are thrown only if Julia is started with
41+
# julia --warn-overwrite=yes
42+
# The entire test file is run, and then the warnings are checked on exit
43+
# from `include()`.
44+
Test.@test_nowarn include("$(submodule)/runtests.jl")
3645
GC.gc() # Force GC run here to reduce memory pressure
3746
end
3847

0 commit comments

Comments
 (0)