test-unit 3.3.2 → 3.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/BSDL +24 -0
- data/COPYING +41 -44
- data/README.md +4 -8
- data/Rakefile +0 -14
- data/doc/text/news.md +85 -0
- data/lib/test-unit.rb +0 -17
- data/lib/test/unit.rb +171 -157
- data/lib/test/unit/assertions.rb +60 -53
- data/lib/test/unit/autorunner.rb +57 -25
- data/lib/test/unit/code-snippet-fetcher.rb +4 -2
- data/lib/test/unit/color-scheme.rb +20 -2
- data/lib/test/unit/data.rb +2 -2
- data/lib/test/unit/diff.rb +2 -3
- data/lib/test/unit/notification.rb +9 -7
- data/lib/test/unit/omission.rb +34 -31
- data/lib/test/unit/pending.rb +12 -11
- data/lib/test/unit/priority.rb +7 -3
- data/lib/test/unit/runner/console.rb +0 -17
- data/lib/test/unit/testcase.rb +138 -123
- data/lib/test/unit/ui/console/testrunner.rb +16 -1
- data/lib/test/unit/util/observable.rb +2 -2
- data/lib/test/unit/util/output.rb +5 -4
- data/lib/test/unit/version.rb +1 -1
- data/test/test-assertions.rb +27 -19
- data/test/test-color-scheme.rb +42 -1
- data/test/test-priority.rb +19 -8
- data/test/test-test-case.rb +6 -1
- metadata +39 -40
- data/GPL +0 -339
- data/LGPL +0 -502
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa35cb23e3ed29c4404a4547bafab08b764435c98defa3f630bd651238261f01
|
4
|
+
data.tar.gz: a792423f3928652f0dec87ab0d29b2acdbd1f100c3e62e64db3f57ecb788f918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba6bc75724ad5d7919ea7cc23fee209c654443641d4e74a4a070b27a83babe70773538556a4762e35c77adf4bb9016191500c33ea1d4412116003d944528eab
|
7
|
+
data.tar.gz: bf6d06a9591db3d142e10f5924f92ee144c291ad1e083d745533d8b0c57555ffdb1b0fe033cab20ecb9eda4f037c9fe5ec1418176fad0ffd948e6bff48f6373a
|
data/BSDL
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (C) 2003-2007 Nathaniel Talbott. All rights reserved.
|
2
|
+
Copyright (C) 2008 Ryan Davis. All rights reserved.
|
3
|
+
Copyright (C) 2008-2020 Sutou Kouhei. All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions
|
7
|
+
are met:
|
8
|
+
1. Redistributions of source code must retain the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
12
|
+
documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
17
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
20
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
21
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
22
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
23
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
data/COPYING
CHANGED
@@ -2,66 +2,63 @@ test-unit is copyrighted free software by Kouhei Sutou
|
|
2
2
|
<kou@cozmixng.org>, Ryan Davis <ryand-ruby@zenspider.com>
|
3
3
|
and Nathaniel Talbott <nathaniel@talbott.ws>.
|
4
4
|
|
5
|
-
You can redistribute it and/or modify it under either the terms of the
|
6
|
-
|
5
|
+
You can redistribute it and/or modify it under either the terms of the
|
6
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
1. You may make and give away verbatim copies of the source form of the
|
9
|
+
software without restriction, provided that you duplicate all of the
|
10
|
+
original copyright notices and associated disclaimers.
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
2. You may modify your copy of the software in any way, provided that
|
13
|
+
you do at least ONE of the following:
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
a. place your modifications in the Public Domain or otherwise
|
16
|
+
make them Freely Available, such as by posting said
|
17
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
18
|
+
the author to include your modifications in the software.
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
b. use the modified software only within your corporation or
|
21
|
+
organization.
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
c. give non-standard binaries non-standard names, with
|
24
|
+
instructions on where to get the original software distribution.
|
25
25
|
|
26
|
-
|
26
|
+
d. make other distribution arrangements with the author.
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
3. You may distribute the software in object code or binary form,
|
29
|
+
provided that you do at least ONE of the following:
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
a. distribute the binaries and library files of the software,
|
32
|
+
together with instructions (in the manual page or equivalent)
|
33
|
+
on where to get the original distribution.
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
b. accompany the distribution with the machine-readable source of
|
36
|
+
the software.
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
c. give non-standard binaries non-standard names, with
|
39
|
+
instructions on where to get the original software distribution.
|
40
40
|
|
41
|
-
|
41
|
+
d. make other distribution arrangements with the author.
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
4. You may modify and include the part of the software into any other
|
44
|
+
software (possibly commercial). But some files in the distribution
|
45
|
+
are not written by the author, so that they are not under these terms.
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
For the list of those files and their copying conditions, see the
|
48
|
+
file LEGAL.
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
5. The scripts and library files supplied as input to or produced as
|
51
|
+
output from the software do not automatically fall under the
|
52
|
+
copyright of the software, but belong to whomever generated them,
|
53
|
+
and may be sold commercially, and may be aggregated with this
|
54
|
+
software.
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
57
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
58
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
59
|
+
PURPOSE.
|
60
60
|
|
61
61
|
Exceptions
|
62
62
|
----------
|
63
63
|
|
64
|
-
* lib/test/unit/diff.rb: This license
|
65
|
-
or later
|
66
|
-
|
67
|
-
* lib/test-unit.rb: This license and/or LGPLv2.1 or later
|
64
|
+
* lib/test/unit/diff.rb: This license and PSF license
|
data/README.md
CHANGED
@@ -51,17 +51,13 @@ If you want to use full test-unit features:
|
|
51
51
|
|
52
52
|
## License
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
This software is distributed under the same terms as ruby.
|
54
|
+
This software is distributed under either the terms of new Ruby
|
55
|
+
License or BSDL. See the file [COPYING](COPYING).
|
57
56
|
|
58
57
|
Exception:
|
59
58
|
|
60
|
-
* lib/test/unit/diff.rb is a triple license of the Ruby license
|
61
|
-
|
62
|
-
|
63
|
-
* lib/test-unit.rb is a dual license of the Ruby license and LGPLv2.1
|
64
|
-
or later.
|
59
|
+
* lib/test/unit/diff.rb is a triple license of (the new Ruby license
|
60
|
+
or BSDL) and PSF license.
|
65
61
|
|
66
62
|
## Authors
|
67
63
|
|
data/Rakefile
CHANGED
@@ -1,20 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
3
|
# Copyright (C) 2008-2017 Kouhei Sutou <kou@clear-code.com>
|
4
|
-
#
|
5
|
-
# This library is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU Lesser General Public
|
7
|
-
# License as published by the Free Software Foundation; either
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This library is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# Lesser General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Lesser General Public
|
16
|
-
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
4
|
|
19
5
|
Encoding.default_internal = "UTF-8" if defined?(Encoding.default_internal)
|
20
6
|
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,90 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.3.7 - 2020-11-18 {#version-3-3-7}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Improved TruffleRuby support.
|
8
|
+
[GitHub#171][Reported by Benoit Daloze]
|
9
|
+
|
10
|
+
* Removed needless `to_sym`.
|
11
|
+
[GitHub#177][Patch by icm7216]
|
12
|
+
|
13
|
+
* `assert_raise`: Added backtrace for actual error.
|
14
|
+
|
15
|
+
* Improved terminal color availability detection.
|
16
|
+
[GitHub#175][Patch by nicholas a. evans]
|
17
|
+
|
18
|
+
* Changed license to the new Ruby's.
|
19
|
+
[GitHub#174]
|
20
|
+
|
21
|
+
### Fixes
|
22
|
+
|
23
|
+
* Fixed a typo in `--help` output:
|
24
|
+
[GitHub#176][Patch by icm7216]
|
25
|
+
|
26
|
+
### Thanks
|
27
|
+
|
28
|
+
* Benoit Daloze
|
29
|
+
|
30
|
+
* icm7216
|
31
|
+
|
32
|
+
* nicholas a. evans
|
33
|
+
|
34
|
+
## 3.3.6 - 2020-06-10 {#version-3-3-6}
|
35
|
+
|
36
|
+
### Improvements
|
37
|
+
|
38
|
+
* `name`, `--ignore-name`:
|
39
|
+
|
40
|
+
* Added support for regular expression options.
|
41
|
+
|
42
|
+
* Added support for matching with class name in exact match mode.
|
43
|
+
[Reported by Jun Aruga]
|
44
|
+
|
45
|
+
* Updated ruby-talk mailing list information
|
46
|
+
[GitHub#168][Patch by Chris Kampmeier]
|
47
|
+
|
48
|
+
### Thanks
|
49
|
+
|
50
|
+
* Chris Kampmeier
|
51
|
+
|
52
|
+
* Jun Aruga
|
53
|
+
|
54
|
+
## 3.3.5 - 2020-01-10 {#version-3-3-5}
|
55
|
+
|
56
|
+
### Improvements
|
57
|
+
|
58
|
+
* Improved code snippet showing with different default external encoding.
|
59
|
+
[GitHub#166][Patch by Yuta Iwama]
|
60
|
+
|
61
|
+
### Thanks
|
62
|
+
|
63
|
+
* Yuta Iwama
|
64
|
+
|
65
|
+
## 3.3.4 - 2019-09-30 {#version-3-3-4}
|
66
|
+
|
67
|
+
### Improvements
|
68
|
+
|
69
|
+
* Converted markup format to Markdown from RDoc.
|
70
|
+
[GitHub#164][Patch by OGAWA KenIchi]
|
71
|
+
|
72
|
+
* test: Stopped to depend on `Time#inspect` format.
|
73
|
+
[GitHub#165][Reported by Benoit Daloze]
|
74
|
+
|
75
|
+
### Thanks
|
76
|
+
|
77
|
+
* OGAWA KenIchi
|
78
|
+
|
79
|
+
* Benoit Daloze
|
80
|
+
|
81
|
+
## 3.3.3 - 2019-05-10 {#version-3-3-3}
|
82
|
+
|
83
|
+
### Fixed
|
84
|
+
|
85
|
+
* Fixed a bug that priority mode with test case name that uses
|
86
|
+
special characters such as `?` can't be used on Windows.
|
87
|
+
|
3
88
|
## 3.3.2 - 2019-04-11 {#version-3-3-2}
|
4
89
|
|
5
90
|
### Fixes
|
data/lib/test-unit.rb
CHANGED
@@ -1,21 +1,4 @@
|
|
1
1
|
# Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# License: Ruby's or LGPLv2.1 or later
|
4
|
-
#
|
5
|
-
# This library is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU Lesser General Public
|
7
|
-
# License as published by the Free Software Foundation; either
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This library is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# Lesser General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Lesser General Public
|
16
|
-
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
18
|
-
# 02110-1301 USA
|
19
2
|
|
20
3
|
module Test
|
21
4
|
module Unit
|
data/lib/test/unit.rb
CHANGED
@@ -3,10 +3,10 @@ require 'test/unit/autorunner'
|
|
3
3
|
|
4
4
|
module Test # :nodoc:
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
6
|
+
# # Test::Unit - Ruby Unit Testing Framework
|
7
|
+
#
|
8
|
+
# ## Introduction
|
9
|
+
#
|
10
10
|
# Unit testing is making waves all over the place, largely due to the
|
11
11
|
# fact that it is a core practice of XP. While XP is great, unit testing
|
12
12
|
# has been around for a long time and has always been a good idea. One
|
@@ -18,19 +18,19 @@ module Test # :nodoc:
|
|
18
18
|
# as possible, you slowly build up a wall of things that cannot break
|
19
19
|
# without you immediately knowing about it. This is when unit testing
|
20
20
|
# hits its peak usefulness.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# Enter Test::Unit, a framework for unit testing in Ruby, helping you to
|
23
23
|
# design, debug and evaluate your code by making it easy to write and
|
24
24
|
# have tests for it.
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
25
|
+
#
|
26
|
+
#
|
27
|
+
# ## Notes
|
28
|
+
#
|
29
29
|
# Test::Unit has grown out of and superceded Lapidary.
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# ## Feedback
|
33
|
+
#
|
34
34
|
# I like (and do my best to practice) XP, so I value early releases,
|
35
35
|
# user feedback, and clean, simple, expressive code. There is always
|
36
36
|
# room for improvement in everything I do, and Test::Unit is no
|
@@ -41,79 +41,84 @@ module Test # :nodoc:
|
|
41
41
|
# hear about any successes you have with Test::Unit, and any
|
42
42
|
# documentation you might add will be greatly appreciated. My contact
|
43
43
|
# info is below.
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
44
|
+
#
|
45
|
+
#
|
46
|
+
# ## Contact Information
|
47
|
+
#
|
48
|
+
# * [GitHub issues on
|
49
|
+
# test-unit/test-unit](https://github.com/test-unit/test-unit/issues):
|
50
|
+
# If you have any issues, please report them to here.
|
51
|
+
#
|
52
|
+
# * [GitHub pull requests on
|
53
|
+
# test-unit/test-unit](https://github.com/test-unit/test-unit/pulls):
|
54
|
+
# If you have any patches, please report them to here.
|
55
|
+
#
|
56
|
+
# * [ruby-talk mailing
|
57
|
+
# list](https://www.ruby-lang.org/en/community/mailing-lists/):
|
58
|
+
# If you have any questions, you can ask them here.
|
59
|
+
#
|
60
|
+
#
|
61
|
+
# ## Credits
|
62
|
+
#
|
58
63
|
# I'd like to thank...
|
59
|
-
#
|
64
|
+
#
|
60
65
|
# Matz, for a great language!
|
61
|
-
#
|
66
|
+
#
|
62
67
|
# Masaki Suketa, for his work on RubyUnit, which filled a vital need in
|
63
68
|
# the Ruby world for a very long time. I'm also grateful for his help in
|
64
69
|
# polishing Test::Unit and getting the RubyUnit compatibility layer
|
65
70
|
# right. His graciousness in allowing Test::Unit to supercede RubyUnit
|
66
71
|
# continues to be a challenge to me to be more willing to defer my own
|
67
72
|
# rights.
|
68
|
-
#
|
73
|
+
#
|
69
74
|
# Ken McKinlay, for his interest and work on unit testing, and for his
|
70
75
|
# willingness to dialog about it. He was also a great help in pointing
|
71
76
|
# out some of the holes in the RubyUnit compatibility layer.
|
72
|
-
#
|
77
|
+
#
|
73
78
|
# Dave Thomas, for the original idea that led to the extremely simple
|
74
79
|
# "require 'test/unit'", plus his code to improve it even more by
|
75
80
|
# allowing the selection of tests from the command-line. Also, without
|
76
81
|
# RDoc, the documentation for Test::Unit would stink a lot more than it
|
77
82
|
# does now.
|
78
|
-
#
|
83
|
+
#
|
79
84
|
# Everyone who's helped out with bug reports, feature ideas,
|
80
85
|
# encouragement to continue, etc. It's a real privilege to be a part of
|
81
86
|
# the Ruby community.
|
82
|
-
#
|
87
|
+
#
|
83
88
|
# The guys at RoleModel Software, for putting up with me repeating, "But
|
84
89
|
# this would be so much easier in Ruby!" whenever we're coding in Java.
|
85
|
-
#
|
90
|
+
#
|
86
91
|
# My Creator, for giving me life, and giving it more abundantly.
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
92
|
+
#
|
93
|
+
#
|
94
|
+
# ## License
|
95
|
+
#
|
91
96
|
# Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
|
92
97
|
# software, and is distributed under the Ruby license. See the COPYING
|
93
98
|
# file.
|
94
|
-
#
|
99
|
+
#
|
95
100
|
# Exception: lib/test/unit/diff.rb is copyright (c)
|
96
101
|
# 2008-2010 Kouhei Sutou and 2001-2008 Python Software
|
97
102
|
# Foundation. It is free software, and is distributed
|
98
103
|
# under the Ruby license and/or the PSF license. See the
|
99
104
|
# COPYING file and PSFL file.
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
105
|
+
#
|
106
|
+
# ## Warranty
|
107
|
+
#
|
103
108
|
# This software is provided "as is" and without any express or
|
104
109
|
# implied warranties, including, without limitation, the implied
|
105
110
|
# warranties of merchantibility and fitness for a particular
|
106
111
|
# purpose.
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
112
|
+
#
|
113
|
+
#
|
114
|
+
# ## Author
|
115
|
+
#
|
111
116
|
# Nathaniel Talbott.
|
112
117
|
# Copyright (c) 2000-2003, Nathaniel Talbott
|
113
118
|
#
|
114
119
|
# ----
|
115
120
|
#
|
116
|
-
#
|
121
|
+
# # Usage
|
117
122
|
#
|
118
123
|
# The general idea behind unit testing is that you write a _test_
|
119
124
|
# _method_ that makes certain _assertions_ about your code, working
|
@@ -125,7 +130,7 @@ module Test # :nodoc:
|
|
125
130
|
# pieces.
|
126
131
|
#
|
127
132
|
#
|
128
|
-
#
|
133
|
+
# ## Assertions
|
129
134
|
#
|
130
135
|
# These are the heart of the framework. Think of an assertion as a
|
131
136
|
# statement of expected outcome, i.e. "I assert that x should be equal
|
@@ -137,7 +142,7 @@ module Test # :nodoc:
|
|
137
142
|
# of the current assertions, see Test::Unit::Assertions.
|
138
143
|
#
|
139
144
|
#
|
140
|
-
#
|
145
|
+
# ## Test Method & Test Fixture
|
141
146
|
#
|
142
147
|
# Obviously, these assertions have to be called within a context that
|
143
148
|
# knows about them and can do something meaningful with their
|
@@ -197,7 +202,7 @@ module Test # :nodoc:
|
|
197
202
|
# end
|
198
203
|
#
|
199
204
|
#
|
200
|
-
#
|
205
|
+
# ## Test Runners
|
201
206
|
#
|
202
207
|
# So, now you have this great test class, but you still
|
203
208
|
# need a way to run it and view any failures that occur
|
@@ -208,10 +213,10 @@ module Test # :nodoc:
|
|
208
213
|
# runner simply set default test runner ID to
|
209
214
|
# Test::Unit::AutoRunner:
|
210
215
|
#
|
211
|
-
#
|
212
|
-
#
|
216
|
+
# require 'test/unit'
|
217
|
+
# Test::Unit::AutoRunner.default_runner = "gtk2"
|
213
218
|
#
|
214
|
-
#
|
219
|
+
# ## Test Suite
|
215
220
|
#
|
216
221
|
# As more and more unit tests accumulate for a given project, it
|
217
222
|
# becomes a real drag running them one at a time, and it also
|
@@ -228,17 +233,17 @@ module Test # :nodoc:
|
|
228
233
|
# 'test/unit'. What does this mean? It means you could
|
229
234
|
# write the above test case like this instead:
|
230
235
|
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
236
|
+
# require 'test/unit'
|
237
|
+
# require 'test_myfirsttests'
|
238
|
+
# require 'test_moretestsbyme'
|
239
|
+
# require 'test_anothersetoftests'
|
235
240
|
#
|
236
241
|
# Test::Unit is smart enough to find all the test cases existing in
|
237
242
|
# the ObjectSpace and wrap them up into a suite for you. It then runs
|
238
243
|
# the dynamic suite using the console TestRunner.
|
239
244
|
#
|
240
245
|
#
|
241
|
-
#
|
246
|
+
# ## Configuration file
|
242
247
|
#
|
243
248
|
# Test::Unit reads 'test-unit.yml' in the current working
|
244
249
|
# directory as Test::Unit's configuration file. It can
|
@@ -254,53 +259,58 @@ module Test # :nodoc:
|
|
254
259
|
#
|
255
260
|
# Here are sample color scheme definitions:
|
256
261
|
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
#
|
265
|
-
#
|
266
|
-
#
|
262
|
+
# color_schemes:
|
263
|
+
# inverted:
|
264
|
+
# success:
|
265
|
+
# name: red
|
266
|
+
# bold: true
|
267
|
+
# failure:
|
268
|
+
# name: green
|
269
|
+
# bold: true
|
270
|
+
# other_scheme:
|
271
|
+
# ...
|
267
272
|
#
|
268
273
|
# Here are the syntax of color scheme definitions:
|
269
274
|
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
# SCHEME_NAME
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
275
|
+
# color_schemes:
|
276
|
+
# SCHEME_NAME:
|
277
|
+
# EVENT_NAME:
|
278
|
+
# name: COLOR_NAME
|
279
|
+
# intensity: BOOLEAN
|
280
|
+
# bold: BOOLEAN
|
281
|
+
# italic: BOOLEAN
|
282
|
+
# underline: BOOLEAN
|
283
|
+
# ...
|
284
|
+
# ...
|
285
|
+
#
|
286
|
+
# SCHEME_NAME
|
287
|
+
# : the name of the color scheme
|
288
|
+
#
|
289
|
+
# EVENT_NAME
|
290
|
+
# : one of [success, failure, pending, omission, notification, error]
|
291
|
+
#
|
292
|
+
# COLOR_NAME
|
293
|
+
# : one of [black, red, green, yellow, blue, magenta, cyan, white]
|
294
|
+
#
|
295
|
+
# BOOLEAN
|
296
|
+
# : true or false
|
287
297
|
#
|
288
298
|
# You can use the above 'inverted' color scheme with the
|
289
299
|
# following configuration:
|
290
300
|
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
#
|
301
|
+
# runner: console
|
302
|
+
# console_options:
|
303
|
+
# color_scheme: inverted
|
304
|
+
# color_schemes:
|
305
|
+
# inverted:
|
306
|
+
# success:
|
307
|
+
# name: red
|
308
|
+
# bold: true
|
309
|
+
# failure:
|
310
|
+
# name: green
|
311
|
+
# bold: true
|
302
312
|
#
|
303
|
-
#
|
313
|
+
# ## Questions?
|
304
314
|
#
|
305
315
|
# I'd really like to get feedback from all levels of Ruby
|
306
316
|
# practitioners about typos, grammatical errors, unclear statements,
|
@@ -331,51 +341,53 @@ module Test # :nodoc:
|
|
331
341
|
# To register multiple hooks, call this method multiple times.
|
332
342
|
#
|
333
343
|
# Here is an example test case:
|
334
|
-
# Test::Unit.at_start do
|
335
|
-
# # ...
|
336
|
-
# end
|
337
|
-
#
|
338
|
-
# class TestMyClass1 < Test::Unit::TestCase
|
339
|
-
# class << self
|
340
|
-
# def startup
|
341
|
-
# # ...
|
342
|
-
# end
|
343
|
-
# end
|
344
344
|
#
|
345
|
-
#
|
345
|
+
# Test::Unit.at_start do
|
346
346
|
# # ...
|
347
347
|
# end
|
348
348
|
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
349
|
+
# class TestMyClass1 < Test::Unit::TestCase
|
350
|
+
# class << self
|
351
|
+
# def startup
|
352
|
+
# # ...
|
353
|
+
# end
|
354
|
+
# end
|
352
355
|
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
# end
|
356
|
+
# def setup
|
357
|
+
# # ...
|
358
|
+
# end
|
357
359
|
#
|
358
|
-
#
|
359
|
-
# class << self
|
360
|
-
# def startup
|
360
|
+
# def test_my_class1
|
361
361
|
# # ...
|
362
362
|
# end
|
363
|
-
# end
|
364
363
|
#
|
365
|
-
#
|
366
|
-
#
|
364
|
+
# def test_my_class2
|
365
|
+
# # ...
|
366
|
+
# end
|
367
367
|
# end
|
368
368
|
#
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
369
|
+
# class TestMyClass2 < Test::Unit::TestCase
|
370
|
+
# class << self
|
371
|
+
# def startup
|
372
|
+
# # ...
|
373
|
+
# end
|
374
|
+
# end
|
372
375
|
#
|
373
|
-
#
|
374
|
-
#
|
376
|
+
# def setup
|
377
|
+
# # ...
|
378
|
+
# end
|
379
|
+
#
|
380
|
+
# def test_my_class1
|
381
|
+
# # ...
|
382
|
+
# end
|
383
|
+
#
|
384
|
+
# def test_my_class2
|
385
|
+
# # ...
|
386
|
+
# end
|
375
387
|
# end
|
376
|
-
# end
|
377
388
|
#
|
378
389
|
# Here is a call order:
|
390
|
+
#
|
379
391
|
# * at_start
|
380
392
|
# * TestMyClass1.startup
|
381
393
|
# * TestMyClass1#setup
|
@@ -415,51 +427,53 @@ module Test # :nodoc:
|
|
415
427
|
# To register multiple hooks, call this method multiple times.
|
416
428
|
#
|
417
429
|
# Here is an example test case:
|
418
|
-
# Test::Unit.at_exit do
|
419
|
-
# # ...
|
420
|
-
# end
|
421
|
-
#
|
422
|
-
# class TestMyClass1 < Test::Unit::TestCase
|
423
|
-
# class << self
|
424
|
-
# def shutdown
|
425
|
-
# # ...
|
426
|
-
# end
|
427
|
-
# end
|
428
430
|
#
|
429
|
-
#
|
431
|
+
# Test::Unit.at_exit do
|
430
432
|
# # ...
|
431
433
|
# end
|
432
434
|
#
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
435
|
+
# class TestMyClass1 < Test::Unit::TestCase
|
436
|
+
# class << self
|
437
|
+
# def shutdown
|
438
|
+
# # ...
|
439
|
+
# end
|
440
|
+
# end
|
436
441
|
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
# end
|
442
|
+
# def teardown
|
443
|
+
# # ...
|
444
|
+
# end
|
441
445
|
#
|
442
|
-
#
|
443
|
-
# class << self
|
444
|
-
# def shutdown
|
446
|
+
# def test_my_class1
|
445
447
|
# # ...
|
446
448
|
# end
|
447
|
-
# end
|
448
449
|
#
|
449
|
-
#
|
450
|
-
#
|
450
|
+
# def test_my_class2
|
451
|
+
# # ...
|
452
|
+
# end
|
451
453
|
# end
|
452
454
|
#
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
455
|
+
# class TestMyClass2 < Test::Unit::TestCase
|
456
|
+
# class << self
|
457
|
+
# def shutdown
|
458
|
+
# # ...
|
459
|
+
# end
|
460
|
+
# end
|
456
461
|
#
|
457
|
-
#
|
458
|
-
#
|
462
|
+
# def teardown
|
463
|
+
# # ...
|
464
|
+
# end
|
465
|
+
#
|
466
|
+
# def test_my_class1
|
467
|
+
# # ...
|
468
|
+
# end
|
469
|
+
#
|
470
|
+
# def test_my_class2
|
471
|
+
# # ...
|
472
|
+
# end
|
459
473
|
# end
|
460
|
-
# end
|
461
474
|
#
|
462
475
|
# Here is a call order:
|
476
|
+
#
|
463
477
|
# * TestMyClass1#test_my_class1
|
464
478
|
# * TestMyClass1#teardown
|
465
479
|
# * TestMyClass1#test_my_class2
|