lemon 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/HISTORY.md +16 -0
- data/README.md +11 -11
- data/lib/lemon.rb +1 -15
- metadata +62 -86
- data/.ruby +0 -58
- data/.yardopts +0 -6
- data/Config.rb +0 -14
- data/SPECSHEET.md +0 -314
- data/lib/lemon.yml +0 -58
- data/try/.test +0 -8
- data/try/case_error.rb +0 -18
- data/try/case_fail.rb +0 -19
- data/try/case_pass.rb +0 -42
- data/try/case_pending.rb +0 -18
- data/try/case_scope.rb +0 -19
- data/try/case_singleton.rb +0 -18
- data/try/case_untested.rb +0 -14
- data/try/fixtures/calculator.rb +0 -15
- data/try/fixtures/example-use.rb +0 -5
- data/try/fixtures/example.rb +0 -20
- data/try/helpers/loadpath.rb +0 -1
- /data/{spec → demo}/applique/ae.rb +0 -0
- /data/{spec → demo}/applique/fs.rb +0 -0
- /data/{spec → demo}/coverage/01_complete.md +0 -0
- /data/{spec → demo}/coverage/02_incomplete.md +0 -0
- /data/{spec → demo}/coverage/03_extensions.md +0 -0
- /data/{spec → demo}/coverage/applique/lemon.rb +0 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6bc4b46bb63cecf471821a2b8997ba3f2d976917775f90eb28eab9b017051a8b
|
|
4
|
+
data.tar.gz: b55cc5338d2ed16736d51cc15e60458dd8ecca01aab1af0f9b8c6160ca6e2bef
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 49acc3b4d7778393804c67097e96f96ff7461d86dc44768d6c599982d66a03e54ae006fdd108065219fcb0ffc50d874c44336870753688b48552330577e24fc0
|
|
7
|
+
data.tar.gz: aa0ab93ed5a3e4b6357793745f6e530ba09db52ad3ffa8034ab785577f5371807b7ef79e5495ef0829dd14b7f15f11122b1f1f87237d97e1ee4ec167dd898f3d
|
data/HISTORY.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# RELEASE HISTORY
|
|
2
2
|
|
|
3
|
+
## 0.9.2 / 2026-03-31
|
|
4
|
+
|
|
5
|
+
Maintenance release. Modernized project tooling and cleaned up documentation.
|
|
6
|
+
|
|
7
|
+
Changes:
|
|
8
|
+
|
|
9
|
+
* Replace custom Indexer system with standard gemspec.
|
|
10
|
+
* Replace Travis CI with GitHub Actions.
|
|
11
|
+
* Replace Assembly/Reapfile with Rakefile.
|
|
12
|
+
* Simplify version handling (VERSION constant in module).
|
|
13
|
+
* Fix typos and update URLs to HTTPS.
|
|
14
|
+
* Move site from gh-pages to docs/.
|
|
15
|
+
* Remove obsolete files.
|
|
16
|
+
* Clean up .gitignore.
|
|
17
|
+
|
|
18
|
+
|
|
3
19
|
## 0.9.1 / 2012-03-17
|
|
4
20
|
|
|
5
21
|
Thie release fixes some evaluation scope issues, improves how omit and skip
|
data/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Lemon
|
|
2
2
|
|
|
3
|
-
[Homepage](
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
|
|
3
|
+
[Homepage](https://rubyworks.github.io/lemon) |
|
|
4
|
+
[Development](https://github.com/rubyworks/lemon) |
|
|
5
|
+
[Issues](https://github.com/rubyworks/lemon/issues)
|
|
6
|
+
|
|
7
|
+
[](https://rubygems.org/gems/lemon)
|
|
8
|
+
[](https://github.com/rubyworks/lemon/actions/workflows/test.yml)
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
## DESCRIPTION
|
|
@@ -28,7 +30,7 @@ class X
|
|
|
28
30
|
end
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
A test case for the class would be written:
|
|
32
34
|
|
|
33
35
|
``` ruby
|
|
34
36
|
covers 'mylib'
|
|
@@ -58,9 +60,7 @@ The setup (also called the *concern*) is run for every subsequent test until a n
|
|
|
58
60
|
|
|
59
61
|
In conjunction with the `#setup` method, there is a `#teardown` method which can be used "tidy-up" after each test.
|
|
60
62
|
|
|
61
|
-
The `#unit` method is also aliased as `#methed` which is actually a bit more readable. Along with that there is `class_unit` and
|
|
62
|
-
|
|
63
|
-
That is the bulk of the matter for writing Lemon tests. To learn about additional features not mentioned here, check-out the [User Guide](http://wiki.github.com/rubyworks/lemon).
|
|
63
|
+
The `#unit` method is also aliased as `#methed` which is actually a bit more readable. Along with that there is `class_unit` and its alias `class_method` for testing class-level methods. Also note that the test methods may be capitalized (e.g. `#TestCase`), if you prefer that style.
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
## USAGE
|
|
@@ -79,7 +79,7 @@ Normal output is typically a _dot progression_. Other output types can be specif
|
|
|
79
79
|
|
|
80
80
|
$ rubytest -r lemon -f tapy test/cases/name_case.rb
|
|
81
81
|
|
|
82
|
-
See [RubyTest](
|
|
82
|
+
See [RubyTest](https://github.com/rubyworks/rubytest) for more information.
|
|
83
83
|
|
|
84
84
|
### Checking Test Coverage
|
|
85
85
|
|
|
@@ -91,7 +91,7 @@ The coverage tool provides class/module and method coverage and is meant as a "g
|
|
|
91
91
|
|
|
92
92
|
### Generating Test Skeletons
|
|
93
93
|
|
|
94
|
-
Because of the one-to-one correspondence of test case and unit test to class/module and method, Lemon can also generate test scaffolding for previously written code. To do this, use the `lemons generate` or `lemons scaffold` command line utilities.
|
|
94
|
+
Because of the one-to-one correspondence of test case and unit test to class/module and method, Lemon can also generate test scaffolding for previously written code. To do this, use the `lemons generate` or `lemons scaffold` command line utilities.
|
|
95
95
|
|
|
96
96
|
The `generate` command outputs test skeletons to the console. You can use this output as a simple reference or redirect the output to a file and then copy and paste portions into separate files as desired. The `scaffold` command will create actual files in your test directory. Other than that, and the options that go with it (e.g. `--output`), the two commands are the same.
|
|
97
97
|
|
|
@@ -122,6 +122,6 @@ Lemon Unit Testing Framework
|
|
|
122
122
|
|
|
123
123
|
Copyright (c) 2009 Thomas Sawyer, Rubyworks
|
|
124
124
|
|
|
125
|
-
Lemon is distributable in accordance with the **
|
|
125
|
+
Lemon is distributable in accordance with the **BSD-2-Clause** license.
|
|
126
126
|
|
|
127
127
|
See the LICENSE.txt for details.
|
data/lib/lemon.rb
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
module Lemon
|
|
2
|
-
|
|
3
|
-
# Access to metadata.
|
|
4
|
-
def self.metadata
|
|
5
|
-
@metadata ||= (
|
|
6
|
-
require 'yaml'
|
|
7
|
-
YAML.load(File.new(File.dirname(__FILE__) + '/lemon.yml'))
|
|
8
|
-
)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# Access to project metadata as constants.
|
|
12
|
-
def self.const_missing(name)
|
|
13
|
-
key = name.to_s.downcase
|
|
14
|
-
metadata[key] || super(name)
|
|
15
|
-
end
|
|
16
|
-
|
|
2
|
+
VERSION = '0.9.2'
|
|
17
3
|
end
|
|
18
4
|
|
|
19
5
|
# Ruby Test standard location for test objects.
|
metadata
CHANGED
|
@@ -1,100 +1,106 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lemon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.9.2
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Thomas Sawyer
|
|
9
|
-
autorequire:
|
|
10
8
|
bindir: bin
|
|
11
9
|
cert_chain: []
|
|
12
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
11
|
dependencies:
|
|
14
12
|
- !ruby/object:Gem::Dependency
|
|
15
13
|
name: rubytest
|
|
16
|
-
requirement:
|
|
17
|
-
none: false
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
15
|
requirements:
|
|
19
|
-
- -
|
|
16
|
+
- - ">="
|
|
20
17
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '0'
|
|
18
|
+
version: '0.8'
|
|
22
19
|
type: :runtime
|
|
23
20
|
prerelease: false
|
|
24
|
-
version_requirements:
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0.8'
|
|
25
26
|
- !ruby/object:Gem::Dependency
|
|
26
27
|
name: ae
|
|
27
|
-
requirement:
|
|
28
|
-
none: false
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- -
|
|
30
|
+
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '1.8'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements:
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.8'
|
|
36
40
|
- !ruby/object:Gem::Dependency
|
|
37
41
|
name: ansi
|
|
38
|
-
requirement:
|
|
39
|
-
none: false
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
40
43
|
requirements:
|
|
41
|
-
- -
|
|
44
|
+
- - ">="
|
|
42
45
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '1.
|
|
46
|
+
version: '1.5'
|
|
44
47
|
type: :runtime
|
|
45
48
|
prerelease: false
|
|
46
|
-
version_requirements:
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
name: detroit
|
|
49
|
-
requirement: &14345460 !ruby/object:Gem::Requirement
|
|
50
|
-
none: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
|
-
- -
|
|
51
|
+
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
55
|
-
type: :development
|
|
56
|
-
prerelease: false
|
|
57
|
-
version_requirements: *14345460
|
|
53
|
+
version: '1.5'
|
|
58
54
|
- !ruby/object:Gem::Dependency
|
|
59
|
-
name:
|
|
60
|
-
requirement:
|
|
61
|
-
none: false
|
|
55
|
+
name: rake
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
62
57
|
requirements:
|
|
63
|
-
- -
|
|
58
|
+
- - ">="
|
|
64
59
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: '
|
|
60
|
+
version: '13'
|
|
66
61
|
type: :development
|
|
67
62
|
prerelease: false
|
|
68
|
-
version_requirements:
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '13'
|
|
69
68
|
- !ruby/object:Gem::Dependency
|
|
70
69
|
name: qed
|
|
71
|
-
requirement:
|
|
72
|
-
none: false
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
71
|
requirements:
|
|
74
|
-
- -
|
|
72
|
+
- - ">="
|
|
75
73
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: '
|
|
74
|
+
version: '2.9'
|
|
77
75
|
type: :development
|
|
78
76
|
prerelease: false
|
|
79
|
-
version_requirements:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '2.9'
|
|
82
|
+
description: Lemon is a unit testing framework that tightly correlates class to test
|
|
83
|
+
case and method to test unit.
|
|
83
84
|
email:
|
|
84
85
|
- transfire@gmail.com
|
|
85
86
|
executables:
|
|
86
87
|
- lemons
|
|
87
88
|
extensions: []
|
|
88
|
-
extra_rdoc_files:
|
|
89
|
-
|
|
89
|
+
extra_rdoc_files: []
|
|
90
|
+
files:
|
|
90
91
|
- HISTORY.md
|
|
92
|
+
- LICENSE.txt
|
|
91
93
|
- README.md
|
|
92
|
-
- SPECSHEET.md
|
|
93
|
-
files:
|
|
94
|
-
- .yardopts
|
|
95
|
-
- .ruby
|
|
96
94
|
- bin/lemons
|
|
95
|
+
- demo/applique/ae.rb
|
|
96
|
+
- demo/applique/fs.rb
|
|
97
|
+
- demo/coverage/01_complete.md
|
|
98
|
+
- demo/coverage/02_incomplete.md
|
|
99
|
+
- demo/coverage/03_extensions.md
|
|
100
|
+
- demo/coverage/applique/lemon.rb
|
|
101
|
+
- lib/lemon.rb
|
|
97
102
|
- lib/lemon/ae.rb
|
|
103
|
+
- lib/lemon/cli.rb
|
|
98
104
|
- lib/lemon/cli/base.rb
|
|
99
105
|
- lib/lemon/cli/coverage.rb
|
|
100
106
|
- lib/lemon/cli/generate.rb
|
|
@@ -102,10 +108,9 @@ files:
|
|
|
102
108
|
- lib/lemon/cli/obrother.rb
|
|
103
109
|
- lib/lemon/cli/scaffold.rb
|
|
104
110
|
- lib/lemon/cli/test.rb
|
|
105
|
-
- lib/lemon/
|
|
111
|
+
- lib/lemon/core_ext.rb
|
|
106
112
|
- lib/lemon/core_ext/kernel.rb
|
|
107
113
|
- lib/lemon/core_ext/module.rb
|
|
108
|
-
- lib/lemon/core_ext.rb
|
|
109
114
|
- lib/lemon/coverage/analyzer.rb
|
|
110
115
|
- lib/lemon/coverage/cover_unit.rb
|
|
111
116
|
- lib/lemon/coverage/formats/abstract.rb
|
|
@@ -127,54 +132,25 @@ files:
|
|
|
127
132
|
- lib/lemon/test_scope.rb
|
|
128
133
|
- lib/lemon/test_setup.rb
|
|
129
134
|
- lib/lemon/test_world.rb
|
|
130
|
-
|
|
131
|
-
- lib/lemon.yml
|
|
132
|
-
- spec/applique/ae.rb
|
|
133
|
-
- spec/applique/fs.rb
|
|
134
|
-
- spec/coverage/01_complete.md
|
|
135
|
-
- spec/coverage/02_incomplete.md
|
|
136
|
-
- spec/coverage/03_extensions.md
|
|
137
|
-
- spec/coverage/applique/lemon.rb
|
|
138
|
-
- try/.test
|
|
139
|
-
- try/case_error.rb
|
|
140
|
-
- try/case_fail.rb
|
|
141
|
-
- try/case_pass.rb
|
|
142
|
-
- try/case_pending.rb
|
|
143
|
-
- try/case_scope.rb
|
|
144
|
-
- try/case_singleton.rb
|
|
145
|
-
- try/case_untested.rb
|
|
146
|
-
- try/fixtures/calculator.rb
|
|
147
|
-
- try/fixtures/example-use.rb
|
|
148
|
-
- try/fixtures/example.rb
|
|
149
|
-
- try/helpers/loadpath.rb
|
|
150
|
-
- LICENSE.txt
|
|
151
|
-
- HISTORY.md
|
|
152
|
-
- README.md
|
|
153
|
-
- SPECSHEET.md
|
|
154
|
-
- Config.rb
|
|
155
|
-
homepage: http://rubyworks.github.com/lemon
|
|
135
|
+
homepage: https://github.com/rubyworks/lemon
|
|
156
136
|
licenses:
|
|
157
137
|
- BSD-2-Clause
|
|
158
|
-
|
|
138
|
+
metadata: {}
|
|
159
139
|
rdoc_options: []
|
|
160
140
|
require_paths:
|
|
161
141
|
- lib
|
|
162
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
|
-
none: false
|
|
164
143
|
requirements:
|
|
165
|
-
- -
|
|
144
|
+
- - ">="
|
|
166
145
|
- !ruby/object:Gem::Version
|
|
167
|
-
version: '
|
|
146
|
+
version: '3.1'
|
|
168
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
|
-
none: false
|
|
170
148
|
requirements:
|
|
171
|
-
- -
|
|
149
|
+
- - ">="
|
|
172
150
|
- !ruby/object:Gem::Version
|
|
173
151
|
version: '0'
|
|
174
152
|
requirements: []
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
signing_key:
|
|
178
|
-
specification_version: 3
|
|
153
|
+
rubygems_version: 3.6.9
|
|
154
|
+
specification_version: 4
|
|
179
155
|
summary: Pucker-strength Unit Testing
|
|
180
156
|
test_files: []
|
data/.ruby
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
source:
|
|
3
|
-
- meta
|
|
4
|
-
- VERSION
|
|
5
|
-
authors:
|
|
6
|
-
- name: Thomas Sawyer
|
|
7
|
-
email: transfire@gmail.com
|
|
8
|
-
copyrights:
|
|
9
|
-
- holder: Rubyworks
|
|
10
|
-
year: '2009'
|
|
11
|
-
license: BSD-2-Clause
|
|
12
|
-
requirements:
|
|
13
|
-
- name: rubytest
|
|
14
|
-
- name: ae
|
|
15
|
-
- name: ansi
|
|
16
|
-
version: 1.3+
|
|
17
|
-
- name: detroit
|
|
18
|
-
groups:
|
|
19
|
-
- build
|
|
20
|
-
development: true
|
|
21
|
-
- name: reap
|
|
22
|
-
groups:
|
|
23
|
-
- build
|
|
24
|
-
development: true
|
|
25
|
-
- name: qed
|
|
26
|
-
groups:
|
|
27
|
-
- test
|
|
28
|
-
development: true
|
|
29
|
-
- name: ripper
|
|
30
|
-
optional: true
|
|
31
|
-
engines:
|
|
32
|
-
- name: ruby
|
|
33
|
-
version: 1.8~
|
|
34
|
-
dependencies: []
|
|
35
|
-
alternatives: []
|
|
36
|
-
conflicts: []
|
|
37
|
-
repositories:
|
|
38
|
-
- uri: git://github.com/proutils/lemon.git
|
|
39
|
-
scm: git
|
|
40
|
-
name: upstream
|
|
41
|
-
resources:
|
|
42
|
-
home: http://rubyworks.github.com/lemon
|
|
43
|
-
code: http://github.com/rubyworks/lemon
|
|
44
|
-
bugs: http://github.com/rubyworks/lemon/issues
|
|
45
|
-
extra: {}
|
|
46
|
-
load_path:
|
|
47
|
-
- lib
|
|
48
|
-
revision: 0
|
|
49
|
-
created: '2009-10-25'
|
|
50
|
-
summary: Pucker-strength Unit Testing
|
|
51
|
-
title: Lemon
|
|
52
|
-
name: lemon
|
|
53
|
-
description: ! 'Lemon is a unit testing framework that tightly correlates
|
|
54
|
-
|
|
55
|
-
class to test case and method to test unit.'
|
|
56
|
-
organization: rubyworks
|
|
57
|
-
version: 0.9.1
|
|
58
|
-
date: '2012-03-09'
|
data/.yardopts
DELETED
data/Config.rb
DELETED
data/SPECSHEET.md
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
== Complete Coverage
|
|
2
|
-
|
|
3
|
-
=== Complete Coverage of Public Interface
|
|
4
|
-
|
|
5
|
-
Given an example script in 'lib/complete_example.rb' as follows:
|
|
6
|
-
|
|
7
|
-
class C1
|
|
8
|
-
def f1; "f1"; end
|
|
9
|
-
def f2; "f2"; end
|
|
10
|
-
def f3; "f3"; end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class C2
|
|
14
|
-
def g1; "g1"; end
|
|
15
|
-
protected
|
|
16
|
-
def g2; "g2"; end
|
|
17
|
-
private
|
|
18
|
-
def g3; "g3"; end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
And given a test case in 'test/complete_example_case.rb' as follows:
|
|
22
|
-
|
|
23
|
-
Covers 'complete_example.rb'
|
|
24
|
-
|
|
25
|
-
TestCase C1 do
|
|
26
|
-
method :f1 do
|
|
27
|
-
test "Returns a String"
|
|
28
|
-
end
|
|
29
|
-
method :f2 do
|
|
30
|
-
test "Returns a String"
|
|
31
|
-
end
|
|
32
|
-
method :f3 do
|
|
33
|
-
test "Returns a String"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
TestCase C2 do
|
|
38
|
-
method :g1 do
|
|
39
|
-
test "Returns a String"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
And we get the coverage information via CoverageAnalyer.
|
|
44
|
-
|
|
45
|
-
require 'lemon'
|
|
46
|
-
|
|
47
|
-
tests = ['test/complete_example_case.rb']
|
|
48
|
-
|
|
49
|
-
coverage = Lemon::CoverageAnalyzer.new(tests, :loadpath=>'lib')
|
|
50
|
-
|
|
51
|
-
Then we should see that there are no uncovered units.
|
|
52
|
-
|
|
53
|
-
coverage.uncovered_units.assert == []
|
|
54
|
-
|
|
55
|
-
And there should be 4 covered units,
|
|
56
|
-
|
|
57
|
-
coverage.covered_units.size.assert == 4
|
|
58
|
-
|
|
59
|
-
one for each public class and method.
|
|
60
|
-
|
|
61
|
-
units = coverage.covered_units.map{ |u| u.to_s }
|
|
62
|
-
|
|
63
|
-
units.assert.include?('C1#f1')
|
|
64
|
-
units.assert.include?('C1#f2')
|
|
65
|
-
units.assert.include?('C1#f3')
|
|
66
|
-
|
|
67
|
-
units.assert.include?('C2#g1')
|
|
68
|
-
|
|
69
|
-
There should not be any coverage for private and protected methods.
|
|
70
|
-
|
|
71
|
-
units.refute.include?('C2#g2')
|
|
72
|
-
units.refute.include?('C2#g3')
|
|
73
|
-
|
|
74
|
-
In addition there should be no uncovered_cases or undefined_units.
|
|
75
|
-
|
|
76
|
-
coverage.undefined_units.assert = []
|
|
77
|
-
coverage.uncovered_cases.assert = []
|
|
78
|
-
|
|
79
|
-
=== Including Private and Protected Methods
|
|
80
|
-
|
|
81
|
-
We will use the same example classes as above, but in this case we will
|
|
82
|
-
add coverage for private and protected methods as well, given a test case
|
|
83
|
-
in 'test/complete_example_case.rb' as follows:
|
|
84
|
-
|
|
85
|
-
Covers 'complete_example.rb'
|
|
86
|
-
|
|
87
|
-
TestCase C1 do
|
|
88
|
-
method :f1 do
|
|
89
|
-
test "Returns a String"
|
|
90
|
-
end
|
|
91
|
-
method :f2 do
|
|
92
|
-
test "Returns a String"
|
|
93
|
-
end
|
|
94
|
-
method :f3 do
|
|
95
|
-
test "Returns a String"
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
TestCase C2 do
|
|
100
|
-
method :g1 do
|
|
101
|
-
test "Returns a String"
|
|
102
|
-
end
|
|
103
|
-
method :g2 do
|
|
104
|
-
test "Returns a String"
|
|
105
|
-
end
|
|
106
|
-
method :g3 do
|
|
107
|
-
test "Returns a String"
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
And we get the coverage information via CoverageAnalyer.
|
|
112
|
-
|
|
113
|
-
require 'lemon'
|
|
114
|
-
|
|
115
|
-
tests = ['test/complete_example_case.rb']
|
|
116
|
-
|
|
117
|
-
coverage = Lemon::CoverageAnalyzer.new(tests, :loadpath=>'lib', :private=>true)
|
|
118
|
-
|
|
119
|
-
Notice the use of the +private+ option. This will add private and protected
|
|
120
|
-
methods to the coverage analysis.
|
|
121
|
-
|
|
122
|
-
Then we should see that there are no uncovered units.
|
|
123
|
-
|
|
124
|
-
coverage.uncovered_units.assert == []
|
|
125
|
-
|
|
126
|
-
And there should be 6 covered units,
|
|
127
|
-
|
|
128
|
-
coverage.covered_units.size.assert == 6
|
|
129
|
-
|
|
130
|
-
one for each class and method.
|
|
131
|
-
|
|
132
|
-
units = coverage.covered_units.map{ |u| u.to_s }
|
|
133
|
-
|
|
134
|
-
units.assert.include?('C1#f1')
|
|
135
|
-
units.assert.include?('C1#f2')
|
|
136
|
-
units.assert.include?('C1#f3')
|
|
137
|
-
|
|
138
|
-
units.assert.include?('C2#g1')
|
|
139
|
-
units.assert.include?('C2#g2')
|
|
140
|
-
units.assert.include?('C2#g3')
|
|
141
|
-
|
|
142
|
-
In addition there should be no uncovered cases or undefined units.
|
|
143
|
-
|
|
144
|
-
coverage.undefined_units.assert = []
|
|
145
|
-
coverage.uncovered_cases.assert = []
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
== Incomplete Coverage
|
|
149
|
-
|
|
150
|
-
=== Incomplete Coverage of Public Interface
|
|
151
|
-
|
|
152
|
-
Given an example script in 'lib/incomplete_example.rb' as follows:
|
|
153
|
-
|
|
154
|
-
class I1
|
|
155
|
-
def f1; "f1"; end
|
|
156
|
-
def f2; "f2"; end
|
|
157
|
-
def f3; "f3"; end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
class I2
|
|
161
|
-
def g1; "g1"; end
|
|
162
|
-
protected
|
|
163
|
-
def g2; "g2"; end
|
|
164
|
-
private
|
|
165
|
-
def g3; "g3"; end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
class I3
|
|
169
|
-
def h1; "h1"; end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
And given a test case in 'test/incomplete_example_case.rb' as follows:
|
|
173
|
-
|
|
174
|
-
Covers 'incomplete_example.rb'
|
|
175
|
-
|
|
176
|
-
TestCase I1 do
|
|
177
|
-
method :f1 do
|
|
178
|
-
test "Returns a String"
|
|
179
|
-
end
|
|
180
|
-
method :f2 do
|
|
181
|
-
test "Returns a String"
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
TestCase I2 do
|
|
186
|
-
method :x1 do
|
|
187
|
-
test "Does not exist"
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
And we get the coverage information via CoverageAnalyer.
|
|
192
|
-
|
|
193
|
-
require 'lemon'
|
|
194
|
-
|
|
195
|
-
tests = ['test/incomplete_example_case.rb']
|
|
196
|
-
|
|
197
|
-
coverage = Lemon::CoverageAnalyzer.new(tests, :loadpath=>'lib')
|
|
198
|
-
|
|
199
|
-
Then we should see that there are 2 unconvered units, I1#f3 and I2#g1
|
|
200
|
-
because no testcase unit was defined for them and they are both public methods.
|
|
201
|
-
|
|
202
|
-
units = coverage.uncovered_units.map{ |u| u.to_s }
|
|
203
|
-
|
|
204
|
-
units.assert.include?('I1#f3')
|
|
205
|
-
units.assert.include?('I2#g1')
|
|
206
|
-
|
|
207
|
-
units.size.assert == 2
|
|
208
|
-
|
|
209
|
-
You might expect that 'I3#h1' would be in the uncovered units list as well,
|
|
210
|
-
since it is a public method and no test unit covers it. However, there is
|
|
211
|
-
no test case for I3 at all, so Lemon takes that to mean that I3 is of
|
|
212
|
-
no interest.
|
|
213
|
-
|
|
214
|
-
units.refute.include?('I3#h1')
|
|
215
|
-
|
|
216
|
-
But I3 will be listed in the uncovered cases list.
|
|
217
|
-
|
|
218
|
-
coverage.uncovered_cases == [I3]
|
|
219
|
-
|
|
220
|
-
Note that uncovered case methods can be included in the uncovered units list
|
|
221
|
-
by setting the +zealous+ option, which we will demonstrated later.
|
|
222
|
-
|
|
223
|
-
There should still be 3 covered units, I1#f1, I1#f2 and I2#x1.
|
|
224
|
-
|
|
225
|
-
coverage.covered_units.size.assert == 3
|
|
226
|
-
|
|
227
|
-
units = coverage.covered_units.map{ |u| u.to_s }
|
|
228
|
-
|
|
229
|
-
units.assert.include?('I1#f1')
|
|
230
|
-
units.assert.include?('I1#f2')
|
|
231
|
-
units.assert.include?('I2#x1')
|
|
232
|
-
|
|
233
|
-
But we will not find any covered units for class I2.
|
|
234
|
-
|
|
235
|
-
units.refute.include?('I2#g1')
|
|
236
|
-
units.refute.include?('I2#g2')
|
|
237
|
-
units.refute.include?('I2#g3')
|
|
238
|
-
|
|
239
|
-
Notice also that we defined a unit for I2#x1, a method that does not exist.
|
|
240
|
-
So it should be listed in the undefined units list.
|
|
241
|
-
|
|
242
|
-
coverage.undefined_units.size.assert == 1
|
|
243
|
-
|
|
244
|
-
units = coverage.undefined_units.map{ |u| u.to_s }
|
|
245
|
-
|
|
246
|
-
units.assert.include?('I2#x1')
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
== Core Extension Coverage
|
|
250
|
-
|
|
251
|
-
=== Kernel Extensions
|
|
252
|
-
|
|
253
|
-
Given an example script in 'lib/extensions_example.rb' as follows:
|
|
254
|
-
|
|
255
|
-
module Kernel
|
|
256
|
-
def f1; "f1"; end
|
|
257
|
-
def f2; "f2"; end
|
|
258
|
-
def f3; "f3"; end
|
|
259
|
-
end
|
|
260
|
-
|
|
261
|
-
And given a test case in 'test/extensions_example_case.rb' as follows:
|
|
262
|
-
|
|
263
|
-
Covers 'extensions_example.rb'
|
|
264
|
-
|
|
265
|
-
TestCase Kernel do
|
|
266
|
-
method :f1 do
|
|
267
|
-
test do
|
|
268
|
-
fl.assert == "f1"
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
method :f2 do
|
|
272
|
-
test do
|
|
273
|
-
f2.assert == "f2"
|
|
274
|
-
end
|
|
275
|
-
end
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
And we get the coverage information via CoverageAnalyer.
|
|
279
|
-
|
|
280
|
-
require 'lemon'
|
|
281
|
-
|
|
282
|
-
tests = ['test/extensions_example_case.rb']
|
|
283
|
-
|
|
284
|
-
coverage = Lemon::CoverageAnalyzer.new(tests, :loadpath=>'lib')
|
|
285
|
-
|
|
286
|
-
Then we should see that there are two covered units, #f1 and #f2.
|
|
287
|
-
|
|
288
|
-
coverage.covered_units.size.assert == 2
|
|
289
|
-
|
|
290
|
-
units = coverage.covered_units.map{ |u| u.to_s }
|
|
291
|
-
|
|
292
|
-
units.assert.include?('Kernel#f1')
|
|
293
|
-
units.assert.include?('Kernel#f2')
|
|
294
|
-
|
|
295
|
-
units.refute.include?('Kernel#f3')
|
|
296
|
-
|
|
297
|
-
And we should see one unconvered unit, #f3.
|
|
298
|
-
|
|
299
|
-
coverage.uncovered_units.size.assert == 1
|
|
300
|
-
|
|
301
|
-
units = coverage.uncovered_units.map{ |u| u.to_s }
|
|
302
|
-
|
|
303
|
-
units.assert.include?('Kernel#f3')
|
|
304
|
-
|
|
305
|
-
There should be zero uncovered cases.
|
|
306
|
-
|
|
307
|
-
coverage.uncovered_cases == []
|
|
308
|
-
|
|
309
|
-
And zero undefined unit.
|
|
310
|
-
|
|
311
|
-
coverage.undefined_units == []
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
data/lib/lemon.yml
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
source:
|
|
3
|
-
- meta
|
|
4
|
-
- VERSION
|
|
5
|
-
authors:
|
|
6
|
-
- name: Thomas Sawyer
|
|
7
|
-
email: transfire@gmail.com
|
|
8
|
-
copyrights:
|
|
9
|
-
- holder: Rubyworks
|
|
10
|
-
year: '2009'
|
|
11
|
-
license: BSD-2-Clause
|
|
12
|
-
requirements:
|
|
13
|
-
- name: rubytest
|
|
14
|
-
- name: ae
|
|
15
|
-
- name: ansi
|
|
16
|
-
version: 1.3+
|
|
17
|
-
- name: detroit
|
|
18
|
-
groups:
|
|
19
|
-
- build
|
|
20
|
-
development: true
|
|
21
|
-
- name: reap
|
|
22
|
-
groups:
|
|
23
|
-
- build
|
|
24
|
-
development: true
|
|
25
|
-
- name: qed
|
|
26
|
-
groups:
|
|
27
|
-
- test
|
|
28
|
-
development: true
|
|
29
|
-
- name: ripper
|
|
30
|
-
optional: true
|
|
31
|
-
engines:
|
|
32
|
-
- name: ruby
|
|
33
|
-
version: 1.8~
|
|
34
|
-
dependencies: []
|
|
35
|
-
alternatives: []
|
|
36
|
-
conflicts: []
|
|
37
|
-
repositories:
|
|
38
|
-
- uri: git://github.com/proutils/lemon.git
|
|
39
|
-
scm: git
|
|
40
|
-
name: upstream
|
|
41
|
-
resources:
|
|
42
|
-
home: http://rubyworks.github.com/lemon
|
|
43
|
-
code: http://github.com/rubyworks/lemon
|
|
44
|
-
bugs: http://github.com/rubyworks/lemon/issues
|
|
45
|
-
extra: {}
|
|
46
|
-
load_path:
|
|
47
|
-
- lib
|
|
48
|
-
revision: 0
|
|
49
|
-
created: '2009-10-25'
|
|
50
|
-
summary: Pucker-strength Unit Testing
|
|
51
|
-
title: Lemon
|
|
52
|
-
name: lemon
|
|
53
|
-
description: ! 'Lemon is a unit testing framework that tightly correlates
|
|
54
|
-
|
|
55
|
-
class to test case and method to test unit.'
|
|
56
|
-
organization: rubyworks
|
|
57
|
-
version: 0.9.1
|
|
58
|
-
date: '2012-03-09'
|
data/try/.test
DELETED
data/try/case_error.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
covers 'example.rb'
|
|
2
|
-
|
|
3
|
-
test_case Example do
|
|
4
|
-
|
|
5
|
-
method :f do
|
|
6
|
-
|
|
7
|
-
test "one and one is two" do
|
|
8
|
-
ExampleUnknown.new.f(1,1).assert == 2
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
test "two and two is four" do
|
|
12
|
-
ExampleUnknown.new.f(2,2).assert == 4
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
data/try/case_fail.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
covers 'example.rb'
|
|
2
|
-
|
|
3
|
-
test_case Example do
|
|
4
|
-
|
|
5
|
-
method :f do
|
|
6
|
-
|
|
7
|
-
test "one and one is two" do
|
|
8
|
-
Example.new.f(1,1).assert == 2
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
test "two and two is four" do
|
|
12
|
-
ex = Example.new
|
|
13
|
-
ex.f(1,2).assert == 4
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
|
data/try/case_pass.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
covers 'example.rb'
|
|
2
|
-
|
|
3
|
-
test_case Example do
|
|
4
|
-
|
|
5
|
-
method :f do
|
|
6
|
-
|
|
7
|
-
setup "without multipler" do
|
|
8
|
-
@ex = Example.new
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
test "1,2" do
|
|
12
|
-
@ex.f(1,2).assert == 3
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
test "2,2" do
|
|
16
|
-
@ex.f(2,2).assert == 4
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
setup "with multipler" do
|
|
21
|
-
@ex = Example.new(2)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
test "1,2" do
|
|
25
|
-
@ex.f(1,2).assert == 4
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
test "2,2" do
|
|
29
|
-
@ex.f(2,2).assert == 6
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
teardown do
|
|
33
|
-
# ...
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
#class_method :m do
|
|
37
|
-
# Example.m(1,1).assert == 1
|
|
38
|
-
#end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
data/try/case_pending.rb
DELETED
data/try/case_scope.rb
DELETED
data/try/case_singleton.rb
DELETED
data/try/case_untested.rb
DELETED
data/try/fixtures/calculator.rb
DELETED
data/try/fixtures/example-use.rb
DELETED
data/try/fixtures/example.rb
DELETED
data/try/helpers/loadpath.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../fixtures')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|