test 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +152 -0
- data/.gitignore +7 -0
- data/.ruby +43 -0
- data/.test +11 -0
- data/.yardopts +7 -0
- data/Assembly +46 -0
- data/COPYING.rdoc +31 -0
- data/HISTORY.md +29 -0
- data/LICENSE.txt +25 -0
- data/MANIFEST +38 -0
- data/PROFILE +31 -0
- data/README.md +110 -0
- data/VERSION +1 -0
- data/bin/ruby-test +4 -0
- data/lib/test.rb +3 -0
- data/lib/test/autorun.rb +18 -0
- data/lib/test/cli.rb +110 -0
- data/lib/test/code_snippet.rb +93 -0
- data/lib/test/config.rb +72 -0
- data/lib/test/core_ext.rb +9 -0
- data/lib/test/core_ext/assertion.rb +30 -0
- data/lib/test/core_ext/exception.rb +8 -0
- data/lib/test/core_ext/string.rb +30 -0
- data/lib/test/rake.rb +120 -0
- data/lib/test/recorder.rb +53 -0
- data/lib/test/reporters/abstract.rb +238 -0
- data/lib/test/reporters/abstract_hash.rb +224 -0
- data/lib/test/reporters/dotprogress.rb +89 -0
- data/lib/test/reporters/html.rb +155 -0
- data/lib/test/reporters/outline.rb +211 -0
- data/lib/test/reporters/progress.rb +197 -0
- data/lib/test/reporters/summary.rb +145 -0
- data/lib/test/reporters/tap.rb +61 -0
- data/lib/test/reporters/tapj.rb +53 -0
- data/lib/test/reporters/tapy.rb +53 -0
- data/lib/test/reporters/test.rb +51 -0
- data/lib/test/runner.rb +342 -0
- data/site/assets/images/test_pattern.jpg +0 -0
- data/site/index.html +31 -0
- data/spec/01_test.md +29 -0
- data/spec/02_case.md +34 -0
- data/spec/applique/ruby-test.rb +2 -0
- data/test/basic_case.rb +11 -0
- data/try/raw_example.rb +41 -0
- data/work/NOTES.md +17 -0
- metadata +129 -0
data/site/index.html
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<style>
|
4
|
+
body { margin: 0; padding: 0; }
|
5
|
+
a { text-decoration: none; color: #888888; padding: 5px 10px; }
|
6
|
+
a:hover { color: white; }
|
7
|
+
|
8
|
+
#main { background: url(assets/images/test_pattern.jpg) top no-repeat; height: 780px;
|
9
|
+
position: relative; margin: 10px 0; padding: 0; }
|
10
|
+
|
11
|
+
#line { width: 100%; color: #cc2222; font-size: 72px; text-align: center;
|
12
|
+
background: red; font-weight: bold; opacity: 0.9; }
|
13
|
+
}
|
14
|
+
</style>
|
15
|
+
</head>
|
16
|
+
|
17
|
+
<body>
|
18
|
+
<div id="main">
|
19
|
+
<div style="height: 340px;"></div>
|
20
|
+
|
21
|
+
<div id="line">
|
22
|
+
<a href="http://github.com/rubyworks/test/wiki">
|
23
|
+
R U B Y T E S T
|
24
|
+
</a>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
</body>
|
30
|
+
|
31
|
+
</html>
|
data/spec/01_test.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
## Defining a Test
|
2
|
+
|
3
|
+
Any object in a test suite that responds to #call, will be executed as
|
4
|
+
a test. For instance, given an abtriray object defined as follows.
|
5
|
+
|
6
|
+
test = Object.new
|
7
|
+
|
8
|
+
def test.okay
|
9
|
+
@okay
|
10
|
+
end
|
11
|
+
|
12
|
+
def test.call
|
13
|
+
@okay = true
|
14
|
+
end
|
15
|
+
|
16
|
+
If we pass this to a test runner as part of a test suite,
|
17
|
+
|
18
|
+
runner = Test::Runner.new(:suite=>[test], :format=>'test')
|
19
|
+
|
20
|
+
success = runner.run
|
21
|
+
|
22
|
+
We will see that the test was called.
|
23
|
+
|
24
|
+
test.assert.okay
|
25
|
+
|
26
|
+
And testing was successful.
|
27
|
+
|
28
|
+
success.assert == true
|
29
|
+
|
data/spec/02_case.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
## Defining a Test Case
|
2
|
+
|
3
|
+
Any object in a test suite that responds to #each, will be iterated over
|
4
|
+
and each entry run a test or another sub-case. For instance, given an abitrary
|
5
|
+
object defined as follows.
|
6
|
+
|
7
|
+
test = Object.new
|
8
|
+
|
9
|
+
def test.okay
|
10
|
+
@okay
|
11
|
+
end
|
12
|
+
|
13
|
+
def test.call
|
14
|
+
@okay = true
|
15
|
+
end
|
16
|
+
|
17
|
+
And placed into an array.
|
18
|
+
|
19
|
+
tests = [test]
|
20
|
+
|
21
|
+
If we pass this to a test runner as part of a test suite,
|
22
|
+
|
23
|
+
runner = Test::Runner.new(:suite=>[tests], :format=>'test')
|
24
|
+
|
25
|
+
success = runner.run
|
26
|
+
|
27
|
+
We will see that the test was called.
|
28
|
+
|
29
|
+
test.assert.okay
|
30
|
+
|
31
|
+
And testing was successful.
|
32
|
+
|
33
|
+
success.assert == true
|
34
|
+
|
data/test/basic_case.rb
ADDED
data/try/raw_example.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
class RawTest
|
2
|
+
def initialize(label, &block)
|
3
|
+
@label = label
|
4
|
+
@block = block
|
5
|
+
end
|
6
|
+
def to_s
|
7
|
+
@label.to_s
|
8
|
+
end
|
9
|
+
def call
|
10
|
+
@block.call
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# pass
|
15
|
+
$TEST_SUITE << RawTest.new("all good")do
|
16
|
+
end
|
17
|
+
|
18
|
+
# fail
|
19
|
+
$TEST_SUITE << RawTest.new("not so good")do
|
20
|
+
e = SyntaxError.new("failure is not an option")
|
21
|
+
e.set_assertion(true)
|
22
|
+
raise e
|
23
|
+
end
|
24
|
+
|
25
|
+
# error
|
26
|
+
$TEST_SUITE << RawTest.new("not good at all") do
|
27
|
+
raise "example error"
|
28
|
+
end
|
29
|
+
|
30
|
+
# todo
|
31
|
+
$TEST_SUITE << RawTest.new("it will be done") do
|
32
|
+
raise NotImplementedError, "but we're not there yet"
|
33
|
+
end
|
34
|
+
|
35
|
+
# omit
|
36
|
+
$TEST_SUITE << RawTest.new("forget about it") do
|
37
|
+
e = NotImplementedError.new("it just can't be done")
|
38
|
+
e.set_assertion(true)
|
39
|
+
raise e
|
40
|
+
end
|
41
|
+
|
data/work/NOTES.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Developer's Notes
|
2
|
+
|
3
|
+
The original specification utilized an `Assertion` base class, defined as
|
4
|
+
`class Assertion < Exception; end`, to distinguish assertion failures from
|
5
|
+
regular exceptions. All test frameworks (AFAIK) have some variation of this
|
6
|
+
class, e.g. Test::Unit has `FailureError`. For this to work, it would be
|
7
|
+
necessary for all such classes to inherit from the common `Assertion` class.
|
8
|
+
While likely not difficult to implement, it was determined that utilizing a
|
9
|
+
common `#assertion` method was more flexible and easier for test frameworks
|
10
|
+
to support.
|
11
|
+
|
12
|
+
Test/Unit provides for _notifications_. Support for notifications is something
|
13
|
+
to consider for a future version.
|
14
|
+
|
15
|
+
Feedback on any of these consideration is greatly appreciated. Just
|
16
|
+
post up an new [issue](http://rubyworks.github/test/issues).
|
17
|
+
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Thomas Sawyer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-08-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ansi
|
16
|
+
requirement: &23355460 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *23355460
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: detroit
|
27
|
+
requirement: &23354640 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *23354640
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: qed
|
38
|
+
requirement: &23353900 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *23353900
|
47
|
+
description: Ruby Test is a universal test harness for Ruby. It can handle any compliant test
|
48
|
+
framework, even running tests from multiple frameworks in a single pass.
|
49
|
+
email:
|
50
|
+
- transfire@gmail.com
|
51
|
+
executables:
|
52
|
+
- ruby-test
|
53
|
+
extensions: []
|
54
|
+
extra_rdoc_files:
|
55
|
+
- LICENSE.txt
|
56
|
+
- COPYING.rdoc
|
57
|
+
- HISTORY.md
|
58
|
+
- README.md
|
59
|
+
files:
|
60
|
+
- .gemspec
|
61
|
+
- .gitignore
|
62
|
+
- .ruby
|
63
|
+
- .test
|
64
|
+
- .yardopts
|
65
|
+
- Assembly
|
66
|
+
- COPYING.rdoc
|
67
|
+
- HISTORY.md
|
68
|
+
- LICENSE.txt
|
69
|
+
- MANIFEST
|
70
|
+
- PROFILE
|
71
|
+
- README.md
|
72
|
+
- VERSION
|
73
|
+
- bin/ruby-test
|
74
|
+
- lib/test.rb
|
75
|
+
- lib/test/autorun.rb
|
76
|
+
- lib/test/cli.rb
|
77
|
+
- lib/test/code_snippet.rb
|
78
|
+
- lib/test/config.rb
|
79
|
+
- lib/test/core_ext.rb
|
80
|
+
- lib/test/core_ext/assertion.rb
|
81
|
+
- lib/test/core_ext/exception.rb
|
82
|
+
- lib/test/core_ext/string.rb
|
83
|
+
- lib/test/rake.rb
|
84
|
+
- lib/test/recorder.rb
|
85
|
+
- lib/test/reporters/abstract.rb
|
86
|
+
- lib/test/reporters/abstract_hash.rb
|
87
|
+
- lib/test/reporters/dotprogress.rb
|
88
|
+
- lib/test/reporters/html.rb
|
89
|
+
- lib/test/reporters/outline.rb
|
90
|
+
- lib/test/reporters/progress.rb
|
91
|
+
- lib/test/reporters/summary.rb
|
92
|
+
- lib/test/reporters/tap.rb
|
93
|
+
- lib/test/reporters/tapj.rb
|
94
|
+
- lib/test/reporters/tapy.rb
|
95
|
+
- lib/test/reporters/test.rb
|
96
|
+
- lib/test/runner.rb
|
97
|
+
- site/assets/images/test_pattern.jpg
|
98
|
+
- site/index.html
|
99
|
+
- spec/01_test.md
|
100
|
+
- spec/02_case.md
|
101
|
+
- spec/applique/ruby-test.rb
|
102
|
+
- test/basic_case.rb
|
103
|
+
- try/raw_example.rb
|
104
|
+
- work/NOTES.md
|
105
|
+
homepage: http://rubyworks.github.com/test
|
106
|
+
licenses: []
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 1.8.5
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: Ruby Universal Test Harness
|
129
|
+
test_files: []
|