method
setup_argv
Ruby latest stable (v2_5_5)
-
0 notes -
Class: Test::Unit
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
setup_argv(original_argv=ARGV)
public
Hide source
# File lib/test/unit.rb, line 11 def self.setup_argv(original_argv=ARGV) minitest_argv = [] files = [] reject = [] original_argv = original_argv.dup while arg = original_argv.shift case arg when '-v' minitest_argv << arg when /\A(-n)(.+)?/, /\A(--name)=?\b(.+)?/ minitest_argv << $1 minitest_argv << ($2 || original_argv.shift) when /\A-x(.+)?/ reject << ($1 || original_argv.shift) else files << arg end end if block_given? files = yield files end files.map! {|f| f = f.tr(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR if File.directory? f Dir["#{f}/**/test_*.rb"] elsif File.file? f f else raise ArgumentError, "file not found: #{f}" end } files.flatten! reject_pat = Regexp.union(reject.map {|r| /#{r}/ }) files.reject! {|f| reject_pat =~ f } files.each {|f| d = File.dirname(path = File.expand_path(f)) unless $:.include? d $: << d end begin require path rescue LoadError puts "#{f}: #{$!}" end } ARGV.replace minitest_argv end