Skip to content
Snippets Groups Projects
Commit 5786f36b authored by Martin Afanasjew's avatar Martin Afanasjew
Browse files

tests: add --only=<test>[/<method>] flag


Simplify running a single test (or even a single method from a single
test), which is useful when developing or debugging a test. Instead of
`brew test TEST=test_diagnostic.rb TESTOPTS=--name=test_check_DYLD_vars`
it is now possible to run `brew tests --only=diagnostic/check_DYLD_vars`
to get the same effect. Similarly, `brew tests --only=diagnostic` maps
to `brew test TEST=test_diagnostic.rb`.

Closes Homebrew/homebrew#48279.

Signed-off-by: default avatarMartin Afanasjew <martin@afanasjew.de>
parent 0d1e72f5
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,11 @@ module Homebrew
args = []
args << "--trace" if ARGV.include? "--trace"
if ARGV.value("only")
test_name, test_method = ARGV.value("only").split("/", 2)
args << "TEST=test_#{test_name}.rb"
args << "TESTOPTS=--name=test_#{test_method}" if test_method
end
args += ARGV.named.select { |v| v[/^TEST(OPTS)?=/] }
system "bundle", "exec", "rake", "test", *args
......
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