File: runtests.rb

package info (click to toggle)
libopenid-ruby 2.1.8debian-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,300 kB
  • ctags: 3,346
  • sloc: ruby: 17,403; xml: 219; sh: 78; python: 30; makefile: 15
file content (45 lines) | stat: -rwxr-xr-x 912 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/ruby

require "logger"
require "stringio"
require "pathname"

require 'test/unit/collector/dir'
require 'test/unit/ui/console/testrunner'

begin
  require 'rubygems'
  require 'memcache'
rescue LoadError
else
  if ENV['TESTING_MEMCACHE']
    TESTING_MEMCACHE = MemCache.new(ENV['TESTING_MEMCACHE'])
  end
end

def main
  old_verbose = $VERBOSE
  $VERBOSE = true

  tests_dir = Pathname.new(__FILE__).dirname.dirname.join('test')

  # Collect tests from everything named test_*.rb.
  c = Test::Unit::Collector::Dir.new

  if c.respond_to?(:base=)
    # In order to supress warnings from ruby 1.8.6 about accessing
    # undefined member
    c.base = tests_dir
    suite = c.collect
  else
    # Because base is not defined in ruby < 1.8.6
    suite = c.collect(tests_dir)
  end

  result = Test::Unit::UI::Console::TestRunner.run(suite)
  result.passed?
ensure
  $VERBOSE = old_verbose
end

exit(main)