summaryrefslogtreecommitdiff
path: root/test/runner.rb
blob: fb72c71556a6d9d1b6946b8ee5f23e476e14d6bd (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'rbconfig'
exit if CROSS_COMPILING
require 'test/unit'

rcsid = %w$Id$
Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze
Release = rcsid[3].freeze

class Module
  def tu_deprecation_warning old, new = nil, kaller = nil
    # stfu - for now...
  end
end

test_dir = File.dirname(__FILE__)

# not sure why these are needed now... but whatever
$:.push(*Dir[File.join(test_dir, '*')].find_all { |path| File.directory? path })

test_files = (Dir[File.join(test_dir, "test_*.rb")] +
              Dir[File.join(test_dir, "**/test_*.rb")])

files = []
other = []

until ARGV.empty? do
  arg = ARGV.shift
  case arg
  when /^-x$/ then
    filter = ARGV.shift
    test_files.reject! { |f| f =~ /#{filter}/ }
  when /^--$/ then
    other.push(*ARGV)
    ARGV.clear
    break
  when /^-/ then
    other << arg
  else
    files << arg
  end
end

test_files = test_files.grep(Regexp.union(*files)) unless files.empty?

ARGV.replace other # this passes through to miniunit

test_files.each do |test|
  require test
end