Line | |
---|
1 | # Author:: Nathaniel Talbott.
|
---|
2 | # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
---|
3 | # License:: Ruby license.
|
---|
4 |
|
---|
5 | require 'runit/testresult'
|
---|
6 | require 'runit/testsuite'
|
---|
7 | require 'runit/assert'
|
---|
8 | require 'runit/error'
|
---|
9 | require 'test/unit/testcase'
|
---|
10 |
|
---|
11 | module RUNIT
|
---|
12 | class TestCase < Test::Unit::TestCase
|
---|
13 | include RUNIT::Assert
|
---|
14 |
|
---|
15 | def self.suite
|
---|
16 | method_names = instance_methods(true)
|
---|
17 | tests = method_names.delete_if { |method_name| method_name !~ /^test/ }
|
---|
18 | suite = TestSuite.new(name)
|
---|
19 | tests.each {
|
---|
20 | |test|
|
---|
21 | catch(:invalid_test) {
|
---|
22 | suite << new(test, name)
|
---|
23 | }
|
---|
24 | }
|
---|
25 | return suite
|
---|
26 | end
|
---|
27 |
|
---|
28 | def initialize(test_name, suite_name=self.class.name)
|
---|
29 | super(test_name)
|
---|
30 | end
|
---|
31 |
|
---|
32 | def assert_equals(*args)
|
---|
33 | assert_equal(*args)
|
---|
34 | end
|
---|
35 |
|
---|
36 | def name
|
---|
37 | super.sub(/^(.*?)\((.*)\)$/, '\2#\1')
|
---|
38 | end
|
---|
39 |
|
---|
40 | def run(result, &progress_block)
|
---|
41 | progress_block = proc {} unless (block_given?)
|
---|
42 | super(result, &progress_block)
|
---|
43 | end
|
---|
44 | end
|
---|
45 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.