1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#!/usr/bin/env ruby
# parse raw -v but not verbose
if ARGV == ["-v"] || ARGV == ["--version"]
puts Maxitest::VERSION
exit 0
end
# parse raw -h
if ARGV == ["-h"] || ARGV == ["--help"]
puts <<~EOF
test given file, folder or file:line
Usage: mtest foo_test.rb
-v to run without bracktrace cleaner
--changed to run all all tests in current `git diff` or `git show`
EOF
exit 0
end
# send rest to testrbl to get --changed support, but do not guess at lines but just convert number to -l
# so minitest-line picks it up
require 'optparse'
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require 'maxitest/vendor/testrbl'
class << Maxitest::Testrbl
def line_pattern_option(file, line)
[file, "-l", line]
end
end
Maxitest::Testrbl.run_from_cli(ARGV)
|