tests: allow specifying test case to run via file name

This commit is contained in:
Moritz Bunkus 2021-08-16 20:29:41 +02:00
parent 05ffcab263
commit 648900e9dd
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85

View File

@ -54,6 +54,9 @@ def main
controller.show_duration = true controller.show_duration = true
elsif arg =~ /-j(\d+)/ elsif arg =~ /-j(\d+)/
controller.num_threads = $1.to_i controller.num_threads = $1.to_i
elsif /^ (!)? test-(\d{4}) .* \.rb $/x.match arg
method = $1 == '!' ? :exclude_test_case : :add_test_case
controller.send(method, $2)
elsif /^ (!)? (\d{1,4}) (?: - (\d{1,4}) )?$/x.match arg elsif /^ (!)? (\d{1,4}) (?: - (\d{1,4}) )?$/x.match arg
method = $1 == '!' ? :exclude_test_case : :add_test_case method = $1 == '!' ? :exclude_test_case : :add_test_case
$2.to_i.upto(($3 || $2).to_i) { |idx| controller.send(method, sprintf("%04d", idx)) } $2.to_i.upto(($3 || $2).to_i) { |idx| controller.send(method, sprintf("%04d", idx)) }