Skip to content
Snippets Groups Projects
Commit d76433bd authored by Florian Atteneder's avatar Florian Atteneder
Browse files

make main() accept numbers which correspond to testparfiles() list (!70)

* make main() accept numbers which correspond to testparfiles() list
parent f94bc12e
No related branches found
No related tags found
1 merge request!70make main() accept numbers which correspond to testparfiles() list
const TO = TimerOutput()
function testparfiles()
function get_testparfiles()
path = normpath(joinpath(@__DIR__, "..", "test", "IntegrationTests", "refs", "testconfig.toml"))
if !isfile(path)
error("failed to locate testconfig $path")
end
config = TOML.parsefile(path)
list = sort(collect(keys(config)))
return list
end
function testparfiles()
list = get_testparfiles()
println("Available list of test parameter files:")
for l in list
println(" - $l")
end
pretty_table(hcat(1:length(list), list), alignment=[:r,:l], noheader=true)
println("Use with `main(\"@test/<name>\")`")
end
......@@ -25,6 +28,10 @@ function parse_parfile(filename)
end
path
else
nr = tryparse(Int64, filename)
if !isnothing(nr)
return parse_parfile(nr)
end
filename
end
if !isfile(path)
......@@ -32,6 +39,15 @@ function parse_parfile(filename)
end
return abspath(path)
end
function parse_parfile(nr::Integer)
testpars = get_testparfiles()
if !(1 <= nr <= length(testpars))
error("there is no test parfile with nr $nr")
end
parfile = testpars[nr]
path = normpath(joinpath(@__DIR__, "..", "test", "IntegrationTests", "refs", parfile, "$parfile.toml"))
return abspath(path)
end
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment