diff options
| author | Martin Afanasjew | 2016-01-20 07:06:09 +0100 |
|---|---|---|
| committer | Martin Afanasjew | 2016-01-21 05:42:06 +0100 |
| commit | 5786f36b624ec10c826953940c74f46041c2b50e (patch) | |
| tree | aa6bab67404792bb6c9da36a4938b0b3bfa9f073 /Library | |
| parent | 0d1e72f55fbe34194c66da1edd6d6c37fc4adca6 (diff) | |
| download | brew-5786f36b624ec10c826953940c74f46041c2b50e.tar.bz2 | |
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: Martin Afanasjew <martin@afanasjew.de>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/tests.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/tests.rb b/Library/Homebrew/cmd/tests.rb index 27be1cd2f..19576ddd3 100644 --- a/Library/Homebrew/cmd/tests.rb +++ b/Library/Homebrew/cmd/tests.rb @@ -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 |
