diff --git a/src/Utilities/Utilities.jl b/src/Utilities/Utilities.jl index 59136f9889..71cfcf0e5d 100644 --- a/src/Utilities/Utilities.jl +++ b/src/Utilities/Utilities.jl @@ -28,7 +28,9 @@ end function replace_acronym(s::AbstractString) s = replace(s, "MathOptInterface.Utilities" => "MOIU") s = replace(s, "MathOptInterface.Bridges" => "MOIB") + # TODO(odow): remove once deprecated tests are deleted. s = replace(s, "MathOptInterface.DeprecatedTest" => "MOIT") + s = replace(s, "MathOptInterface.Test" => "MOIT") s = replace(s, "MathOptInterface" => "MOI") return s end diff --git a/test/Utilities/print.jl b/test/Utilities/print.jl index 455f3e4141..4d664779b5 100644 --- a/test/Utilities/print.jl +++ b/test/Utilities/print.jl @@ -1,10 +1,21 @@ module TestPrint +using Test + using MathOptInterface const MOI = MathOptInterface const MOIU = MOI.Utilities -using Test +function runtests() + for name in names(@__MODULE__; all = true) + if startswith("$(name)", "test_") + @testset "$(name)" begin + getfield(@__MODULE__, name)() + end + end + end + return +end const LATEX = MIME("text/latex") const PLAIN = MIME("text/plain") @@ -523,7 +534,7 @@ function test_nlp() MOI.set(model, MOI.VariableName(), v[i], "x[$i]") end lb, ub = [25.0, 40.0], [Inf, 40.0] - evaluator = MOI.DeprecatedTest.HS071(true) + evaluator = MOI.Test.HS071(true) block_data = MOI.NLPBlockData(MOI.NLPBoundsPair.(lb, ub), evaluator, true) MOI.set(model, MOI.NLPBlock(), block_data) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) @@ -573,14 +584,28 @@ function test_nlp() return end -function runtests() - for name in names(@__MODULE__; all = true) - if startswith("$(name)", "test_") - @testset "$(name)" begin - getfield(@__MODULE__, name)() - end - end - end +function test_print_with_acronym() + @test sprint(MOIU.print_with_acronym, "MathOptInterface") == "MOI" + @test sprint( + MOIU.print_with_acronym, + "MathOptInterface.MathOptInterface", + ) == "MOI.MOI" + @test sprint( + MOIU.print_with_acronym, + "MathOptInterface.Utilities.MathOptInterface", + ) == "MOIU.MOI" + @test sprint(MOIU.print_with_acronym, "MathOptInterfaceXXBridges") == + "MOIXXBridges" + @test sprint(MOIU.print_with_acronym, "MathOptInterface.BridgesXX") == + "MOIBXX" + @test sprint(MOIU.print_with_acronym, "MathOptInterface.Test.x") == "MOIT.x" + @test sprint(MOIU.print_with_acronym, "MathOptInterface.x.Test") == + "MOI.x.Test" + @test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") == + "MOIU.Test" + @test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") == + "MOIU.Test" + return end end diff --git a/test/Utilities/print_with_acronym.jl b/test/Utilities/print_with_acronym.jl deleted file mode 100644 index 9bdd8d15f9..0000000000 --- a/test/Utilities/print_with_acronym.jl +++ /dev/null @@ -1,22 +0,0 @@ -using Test -using MathOptInterface -const MOI = MathOptInterface -const MOIU = MOI.Utilities - -@test sprint(MOIU.print_with_acronym, "MathOptInterface") == "MOI" -@test sprint(MOIU.print_with_acronym, "MathOptInterface.MathOptInterface") == - "MOI.MOI" -@test sprint( - MOIU.print_with_acronym, - "MathOptInterface.Utilities.MathOptInterface", -) == "MOIU.MOI" -@test sprint(MOIU.print_with_acronym, "MathOptInterfaceXXBridges") == - "MOIXXBridges" -@test sprint(MOIU.print_with_acronym, "MathOptInterface.BridgesXX") == "MOIBXX" -@test sprint(MOIU.print_with_acronym, "MathOptInterface.DeprecatedTest.x") == - "MOIT.x" -@test sprint(MOIU.print_with_acronym, "MathOptInterface.x.Test") == "MOI.x.Test" -@test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") == - "MOIU.Test" -@test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") == - "MOIU.Test"