lemon 0.8.5 → 0.9.0
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.
- data/{lemon.gemspec → .gemspec} +0 -0
- data/.ruby +4 -11
- data/Assembly +5 -11
- data/HISTORY.rdoc +31 -0
- data/MANIFEST +45 -55
- data/PROFILE +6 -6
- data/README.md +113 -0
- data/Rakefile +12 -3
- data/VERSION +1 -1
- data/bin/lemonade +8 -0
- data/lib/lemon.rb +52 -2
- data/lib/lemon.yml +4 -11
- data/lib/lemon/{model/ae.rb → ae.rb} +0 -0
- data/lib/lemon/cli.rb +28 -279
- data/lib/lemon/cli/base.rb +139 -0
- data/lib/lemon/cli/coverage.rb +52 -0
- data/lib/lemon/cli/generate.rb +51 -0
- data/lib/lemon/cli/test.rb +50 -0
- data/lib/lemon/core_ext.rb +7 -0
- data/lib/lemon/core_ext/kernel.rb +20 -0
- data/lib/lemon/core_ext/omission.rb +18 -0
- data/lib/lemon/{controller/coverage_analyzer.rb → coverage/analyzer.rb} +41 -19
- data/lib/lemon/{model → coverage}/cover_unit.rb +0 -0
- data/lib/lemon/{view/cover_reports → coverage/formats}/abstract.rb +0 -0
- data/lib/lemon/{view/cover_reports → coverage/formats}/compact.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/outline.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/verbose.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/yaml.rb +1 -1
- data/lib/lemon/{model → coverage}/snapshot.rb +0 -0
- data/lib/lemon/{model → coverage}/source_parser.rb +0 -0
- data/lib/lemon/{controller/scaffold_generator.rb → generator.rb} +53 -14
- data/lib/lemon/test_advice.rb +63 -0
- data/lib/lemon/test_case.rb +270 -0
- data/lib/lemon/test_class.rb +28 -0
- data/lib/lemon/test_method.rb +207 -0
- data/lib/lemon/test_module.rb +114 -0
- data/lib/lemon/test_proc.rb +140 -0
- data/lib/lemon/test_setup.rb +54 -0
- data/lib/lemon/test_world.rb +9 -0
- data/notes/{2010-05-06-files_not_classes.rdoc → 2010-05-06-files-not-classes.rdoc} +0 -0
- data/notes/{2010-07-11-acid_testing.rdoc → 2010-07-11-acid-testing.rdoc} +0 -0
- data/notes/2011-07-07-nailing-down-the-nomenclature.md +6 -0
- data/site/index.html +7 -6
- data/{qed → spec}/applique/fs.rb +0 -0
- data/{qed → spec}/coverage/01_complete.rdoc +26 -16
- data/{qed → spec}/coverage/02_incomplete.rdoc +10 -7
- data/{qed → spec}/coverage/03_extensions.rdoc +10 -6
- data/spec/coverage/applique/lemon.rb +1 -0
- data/try/.test +8 -0
- data/try/case_error.rb +18 -0
- data/try/case_fail.rb +19 -0
- data/try/case_pass.rb +42 -0
- data/try/case_pending.rb +18 -0
- data/try/case_singleton.rb +18 -0
- data/try/case_untested.rb +14 -0
- data/try/fixtures/calculator.rb +15 -0
- data/{demo/fixture → try/fixtures}/example-use.rb +0 -0
- data/{demo/fixture → try/fixtures}/example.rb +0 -0
- data/try/helpers/loadpath.rb +1 -0
- data/{.config → work/deprecated}/cucumber.yml +0 -0
- data/{features → work/deprecated/features}/coverage.feature +0 -0
- data/{features → work/deprecated/features}/generate.feature +0 -0
- data/{features → work/deprecated/features}/step_definitions/coverage_steps.rb +0 -0
- data/{features → work/deprecated/features}/support/ae.rb +0 -0
- data/{features → work/deprecated/features}/support/aruba.rb +0 -0
- data/{features → work/deprecated/features}/test.feature +0 -0
- data/work/deprecated/model/dsl/advice.rb +78 -0
- data/work/deprecated/model/dsl/subject.rb +40 -0
- data/{lib/lemon → work/deprecated}/model/main.rb +40 -29
- data/work/deprecated/model/test.rb +54 -0
- data/work/deprecated/model/test_base_dsl.rb +88 -0
- data/work/deprecated/model/test_clause.rb +112 -0
- data/{lib/lemon → work/deprecated}/model/test_context.rb +24 -24
- data/work/deprecated/model/test_feature.rb +128 -0
- data/work/deprecated/model/test_scenario.rb +137 -0
- data/{lib/lemon → work/deprecated}/model/test_suite.rb +113 -32
- data/work/deprecated/rake.rb +103 -0
- data/{test → work/deprecated/test}/case_coverage_analyzer.rb +0 -0
- data/{test → work/deprecated/test}/case_test_case_dsl.rb +2 -2
- data/{test → work/deprecated/test}/fixtures/case_complete.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/case_inclusion.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/case_incomplete.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/example.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/helper.rb +0 -0
- data/{test → work/deprecated/test}/runner +0 -0
- data/work/old-tests/case_example.rb +15 -0
- data/work/old-tests/feature_example.rb +40 -0
- data/work/reference/dsl2.rb +4 -0
- metadata +101 -98
- data/README.rdoc +0 -103
- data/bin/lemon +0 -4
- data/demo/case_example_error.rb +0 -10
- data/demo/case_example_fail.rb +0 -15
- data/demo/case_example_pass.rb +0 -32
- data/demo/case_example_pending.rb +0 -14
- data/demo/case_example_untested.rb +0 -10
- data/lib/lemon/controller/test_runner.rb +0 -299
- data/lib/lemon/model/pending.rb +0 -10
- data/lib/lemon/model/test_case.rb +0 -305
- data/lib/lemon/model/test_unit.rb +0 -147
- data/lib/lemon/view/test_reports/abstract.rb +0 -256
- data/lib/lemon/view/test_reports/dotprogress.rb +0 -73
- data/lib/lemon/view/test_reports/html.rb +0 -146
- data/lib/lemon/view/test_reports/outline.rb +0 -118
- data/lib/lemon/view/test_reports/summary.rb +0 -131
- data/lib/lemon/view/test_reports/tap.rb +0 -49
- data/lib/lemon/view/test_reports/tapj.rb +0 -130
- data/lib/lemon/view/test_reports/tapy.rb +0 -141
- data/lib/lemon/view/test_reports/verbose.rb +0 -197
- data/work/sandbox/lib/sample.rb +0 -13
- data/work/sandbox/test/sample_case.rb +0 -12
- data/work/trash/example-cover.rb +0 -5
- data/work/trash/example.rb +0 -16
data/{lemon.gemspec → .gemspec}
RENAMED
|
File without changes
|
data/.ruby
CHANGED
|
@@ -9,6 +9,7 @@ copyrights:
|
|
|
9
9
|
replacements: []
|
|
10
10
|
conflicts: []
|
|
11
11
|
requirements:
|
|
12
|
+
- name: test
|
|
12
13
|
- name: ae
|
|
13
14
|
- name: ansi
|
|
14
15
|
version: 1.3+
|
|
@@ -24,14 +25,6 @@ requirements:
|
|
|
24
25
|
groups:
|
|
25
26
|
- test
|
|
26
27
|
development: true
|
|
27
|
-
- name: cucumber
|
|
28
|
-
groups:
|
|
29
|
-
- test
|
|
30
|
-
development: true
|
|
31
|
-
- name: aruba
|
|
32
|
-
groups:
|
|
33
|
-
- test
|
|
34
|
-
development: true
|
|
35
28
|
dependencies: []
|
|
36
29
|
repositories:
|
|
37
30
|
- uri: git://github.com/proutils/lemon.git
|
|
@@ -47,10 +40,10 @@ extra:
|
|
|
47
40
|
alternatives: []
|
|
48
41
|
revision: 0
|
|
49
42
|
title: Lemon
|
|
50
|
-
suite: proutils
|
|
51
43
|
summary: Pucker-tight Unit Testing
|
|
52
44
|
description: Lemon is a unit testing framework that tightly correlates class to test
|
|
53
45
|
case and method to test unit.
|
|
54
|
-
|
|
46
|
+
organization: RubyWorks
|
|
47
|
+
version: 0.9.0
|
|
55
48
|
name: lemon
|
|
56
|
-
date: '2011-
|
|
49
|
+
date: '2011-08-11'
|
data/Assembly
CHANGED
|
@@ -22,22 +22,16 @@ yard:
|
|
|
22
22
|
yardopts: true
|
|
23
23
|
priority: 2
|
|
24
24
|
|
|
25
|
+
qed:
|
|
26
|
+
files: spec
|
|
27
|
+
|
|
25
28
|
qedoc:
|
|
26
29
|
title: Lemony Testing
|
|
30
|
+
files: spec
|
|
27
31
|
output: QED.rdoc
|
|
28
32
|
|
|
29
|
-
cucumber:
|
|
30
|
-
service : Custom
|
|
31
|
-
test : |
|
|
32
|
-
system 'cucumber -q -f progress test/cli'
|
|
33
|
-
|
|
34
|
-
lemon:
|
|
35
|
-
service : Custom
|
|
36
|
-
test : |
|
|
37
|
-
system 'lemon -Itest/fixtures test/*.rb'
|
|
38
|
-
|
|
39
33
|
vclog:
|
|
40
|
-
output
|
|
34
|
+
output:
|
|
41
35
|
- log/AHISTORY.rdoc
|
|
42
36
|
- log/CHANGELOG.rdoc
|
|
43
37
|
|
data/HISTORY.rdoc
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
= RELEASE HISTORY
|
|
2
2
|
|
|
3
|
+
== 0.9.0 / 2011-08-11
|
|
4
|
+
|
|
5
|
+
Version 0.9 is a huge release for Lemon. This release finally makes the transition
|
|
6
|
+
to the new unit subcase syntax --a bit more verbose than the old style but a more
|
|
7
|
+
flexible means of notating unit tests allowing each unit to group together mutiple
|
|
8
|
+
tests. For previous users you will need to change old style tests, e.g.
|
|
9
|
+
|
|
10
|
+
Unit :to_s => "that string" do
|
|
11
|
+
...
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
To the new style:
|
|
15
|
+
|
|
16
|
+
Unit :to_s do
|
|
17
|
+
Test "that string" do
|
|
18
|
+
...
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
This release also moves Lemon over to the new Ruby Test library for test runs.
|
|
23
|
+
The `lemon` command line interface has changed and now uses subcommands rather than command
|
|
24
|
+
opitions. So use `lemon coverage` instead of the old `lemon -c`. Since Lemon now uses Ruby
|
|
25
|
+
Test to run tests, `lemon test` is equivalent to `ruby-test`, and the Ruby Test config file
|
|
26
|
+
should be used to configure test runs instead of `.lemonrc` which is no longer supported.
|
|
27
|
+
|
|
28
|
+
Changes:
|
|
29
|
+
|
|
30
|
+
* Utilize Ruby Test for test execution.
|
|
31
|
+
* Implemented new unit block syntax.
|
|
32
|
+
|
|
33
|
+
|
|
3
34
|
== 0.8.5 / 2011-07-15
|
|
4
35
|
|
|
5
36
|
This release fixes exit code status, which should be -1 if there
|
data/MANIFEST
CHANGED
|
@@ -1,65 +1,55 @@
|
|
|
1
|
-
#!mast .yardopts .ruby bin demo
|
|
1
|
+
#!mast .yardopts .ruby bin demo lib man qed spec test try [A-Z][A-Z]*
|
|
2
2
|
.yardopts
|
|
3
3
|
.ruby
|
|
4
|
-
bin/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
demo/fixture/example-use.rb
|
|
11
|
-
demo/fixture/example.rb
|
|
12
|
-
features/coverage.feature
|
|
13
|
-
features/generate.feature
|
|
14
|
-
features/step_definitions/coverage_steps.rb
|
|
15
|
-
features/support/ae.rb
|
|
16
|
-
features/support/aruba.rb
|
|
17
|
-
features/test.feature
|
|
4
|
+
bin/lemonade
|
|
5
|
+
lib/lemon/ae.rb
|
|
6
|
+
lib/lemon/cli/base.rb
|
|
7
|
+
lib/lemon/cli/coverage.rb
|
|
8
|
+
lib/lemon/cli/generate.rb
|
|
9
|
+
lib/lemon/cli/test.rb
|
|
18
10
|
lib/lemon/cli.rb
|
|
19
|
-
lib/lemon/
|
|
20
|
-
lib/lemon/
|
|
21
|
-
lib/lemon/
|
|
22
|
-
lib/lemon/
|
|
23
|
-
lib/lemon/
|
|
24
|
-
lib/lemon/
|
|
25
|
-
lib/lemon/
|
|
26
|
-
lib/lemon/
|
|
27
|
-
lib/lemon/
|
|
28
|
-
lib/lemon/
|
|
29
|
-
lib/lemon/
|
|
30
|
-
lib/lemon/
|
|
31
|
-
lib/lemon/
|
|
32
|
-
lib/lemon/
|
|
33
|
-
lib/lemon/
|
|
34
|
-
lib/lemon/
|
|
35
|
-
lib/lemon/
|
|
36
|
-
lib/lemon/
|
|
37
|
-
lib/lemon/
|
|
38
|
-
lib/lemon/
|
|
39
|
-
lib/lemon/
|
|
40
|
-
lib/lemon/view/test_reports/outline.rb
|
|
41
|
-
lib/lemon/view/test_reports/summary.rb
|
|
42
|
-
lib/lemon/view/test_reports/tap.rb
|
|
43
|
-
lib/lemon/view/test_reports/tapj.rb
|
|
44
|
-
lib/lemon/view/test_reports/tapy.rb
|
|
45
|
-
lib/lemon/view/test_reports/verbose.rb
|
|
11
|
+
lib/lemon/core_ext/kernel.rb
|
|
12
|
+
lib/lemon/core_ext/omission.rb
|
|
13
|
+
lib/lemon/core_ext.rb
|
|
14
|
+
lib/lemon/coverage/analyzer.rb
|
|
15
|
+
lib/lemon/coverage/cover_unit.rb
|
|
16
|
+
lib/lemon/coverage/formats/abstract.rb
|
|
17
|
+
lib/lemon/coverage/formats/compact.rb
|
|
18
|
+
lib/lemon/coverage/formats/outline.rb
|
|
19
|
+
lib/lemon/coverage/formats/verbose.rb
|
|
20
|
+
lib/lemon/coverage/formats/yaml.rb
|
|
21
|
+
lib/lemon/coverage/snapshot.rb
|
|
22
|
+
lib/lemon/coverage/source_parser.rb
|
|
23
|
+
lib/lemon/generator.rb
|
|
24
|
+
lib/lemon/test_advice.rb
|
|
25
|
+
lib/lemon/test_case.rb
|
|
26
|
+
lib/lemon/test_class.rb
|
|
27
|
+
lib/lemon/test_method.rb
|
|
28
|
+
lib/lemon/test_module.rb
|
|
29
|
+
lib/lemon/test_proc.rb
|
|
30
|
+
lib/lemon/test_setup.rb
|
|
31
|
+
lib/lemon/test_world.rb
|
|
46
32
|
lib/lemon.rb
|
|
47
33
|
lib/lemon.yml
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
test
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
spec/applique/fs.rb
|
|
35
|
+
spec/coverage/01_complete.rdoc
|
|
36
|
+
spec/coverage/02_incomplete.rdoc
|
|
37
|
+
spec/coverage/03_extensions.rdoc
|
|
38
|
+
spec/coverage/applique/lemon.rb
|
|
39
|
+
try/.test
|
|
40
|
+
try/case_error.rb
|
|
41
|
+
try/case_fail.rb
|
|
42
|
+
try/case_pass.rb
|
|
43
|
+
try/case_pending.rb
|
|
44
|
+
try/case_singleton.rb
|
|
45
|
+
try/case_untested.rb
|
|
46
|
+
try/fixtures/calculator.rb
|
|
47
|
+
try/fixtures/example-use.rb
|
|
48
|
+
try/fixtures/example.rb
|
|
49
|
+
try/helpers/loadpath.rb
|
|
60
50
|
HISTORY.rdoc
|
|
61
51
|
PROFILE
|
|
62
|
-
README.rdoc
|
|
63
52
|
QED.rdoc
|
|
53
|
+
README.md
|
|
64
54
|
VERSION
|
|
65
55
|
COPYING.rdoc
|
data/PROFILE
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
title : Lemon
|
|
3
|
-
suite : proutils
|
|
4
3
|
summary: Pucker-tight Unit Testing
|
|
5
4
|
authors:
|
|
6
5
|
- Thomas Sawyer <transfire@gmail.com>
|
|
@@ -16,15 +15,16 @@ resources:
|
|
|
16
15
|
repositories:
|
|
17
16
|
origin: git://github.com/proutils/lemon.git
|
|
18
17
|
|
|
19
|
-
copyright: Copyright 2009 Thomas Sawyer
|
|
20
|
-
license: BSD-2-Clause
|
|
21
|
-
|
|
22
18
|
requirements:
|
|
19
|
+
- test
|
|
23
20
|
- ae
|
|
24
21
|
- ansi 1.3+
|
|
25
22
|
- detroit (build)
|
|
26
23
|
- reap (build)
|
|
27
24
|
- qed (test)
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
|
|
26
|
+
organization: RubyWorks
|
|
27
|
+
|
|
28
|
+
copyright: Copyright 2009 Thomas Sawyer
|
|
29
|
+
license: BSD-2-Clause
|
|
30
30
|
|
data/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Lemon
|
|
2
|
+
|
|
3
|
+
[Homepage](http://rubyworks.github.com/lemon) |
|
|
4
|
+
[User Guide](http://wiki.github.com/rubyworks/lemon) |
|
|
5
|
+
[Development](http://github.com/rubyworks/lemon) |
|
|
6
|
+
[Issues](http://github.com/rubyworks/lemon/issues)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## DESCRIPTION
|
|
10
|
+
|
|
11
|
+
Lemon is a Unit Testing Framework that enforces a strict test structure mirroring the class/module and method structure of the target code. Arguably this promotes the proper technique for low-level unit testing and helps ensure good test coverage.
|
|
12
|
+
|
|
13
|
+
The difference between unit testing and functional testing, and all other forms of testing for that matter, is simply a matter of where the testing *concern* lies. The concerns of unit testing are the concerns of unit tests --the individual methods.
|
|
14
|
+
|
|
15
|
+
IMPORTANT! As of v0.9+ the API has changed. The `unit :name => "description"` notation is no longer supported.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## EXAMPLE
|
|
19
|
+
|
|
20
|
+
Lemon tests are broken down into target class or module and target methods.
|
|
21
|
+
Withn these lie the acutal tests.
|
|
22
|
+
|
|
23
|
+
Let's say we have a script 'mylib.rb' consisting of the class X:
|
|
24
|
+
|
|
25
|
+
``` ruby
|
|
26
|
+
class X
|
|
27
|
+
def a; "a"; end
|
|
28
|
+
end
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
An test case for the class would be written:
|
|
32
|
+
|
|
33
|
+
``` ruby
|
|
34
|
+
Covers 'mylib'
|
|
35
|
+
|
|
36
|
+
TestCase X do
|
|
37
|
+
|
|
38
|
+
Setup "Description of setup." do
|
|
39
|
+
@x = X.new
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Unit :a do
|
|
43
|
+
Test "method #a does something expected" do
|
|
44
|
+
@x.a.assert.is_a? String
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Test "method #a does something else expected" do
|
|
48
|
+
@x.a.assert == "x"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The `covers` method works just like `require` with the exception that it records the file for reference --under certain scenarios it can be used to improve test coverage analysis.
|
|
56
|
+
|
|
57
|
+
The setup (also called the *concern*) is run for every subsequent test until a new setup is defined.
|
|
58
|
+
|
|
59
|
+
In conjunction with the `#setup` method, there is a `#teardown` method which can be used "tidy-up" after each test if need be.
|
|
60
|
+
|
|
61
|
+
You might have also notice by the documentation that the test methods do not have to be capitalized.
|
|
62
|
+
|
|
63
|
+
That is the bulk of the matter for writing Lemon tests. To learn about additonal features not mentioned here, check-out the [User Guide](http://wiki.github.com/rubyworks/lemon).
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## USAGE
|
|
67
|
+
|
|
68
|
+
### Running Tests
|
|
69
|
+
|
|
70
|
+
Tests can be run using the `lemonade` command line tool.
|
|
71
|
+
|
|
72
|
+
$ lemonade test test/cases/name_case.rb
|
|
73
|
+
|
|
74
|
+
Lemon utilizes the Ruby Test system to run tests, the `lemonade test` command simply passes off the running of tests to `ruby-test`. So the `ruby-test` command-line utility can also be used directly:
|
|
75
|
+
|
|
76
|
+
$ ruby-test -r lemon test/cases/name_case.rb
|
|
77
|
+
|
|
78
|
+
Normal output is typical _dot-progress_. Other output types can be specified by the `--format` or `-f` option.
|
|
79
|
+
|
|
80
|
+
$ ruby-test -r lemon -f tap test/cases/name_case.rb
|
|
81
|
+
|
|
82
|
+
See [Ruby Test](http://rubyworks.github.com/test) for more information.
|
|
83
|
+
|
|
84
|
+
### Checking Test Coverage
|
|
85
|
+
|
|
86
|
+
Lemon can check test coverage by loading your target system and comparing it to your tests. To do this use the <code>lemonade coverage</code> command the utility.
|
|
87
|
+
|
|
88
|
+
$ lemonade coverage -Ilib test/cases/*.rb
|
|
89
|
+
|
|
90
|
+
The coverage tool provides class/module and method coverage and is meant to as a "guidance system" for developers working toward complete test coverage. It is not an lines-of-code coverage tool and should not be considered a substitute for one.
|
|
91
|
+
|
|
92
|
+
### Generating Test Skeletons
|
|
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 <code>lemonade generate</code> command line utility and provide the lib location or files of the scripts for which to generate test scaffolding, and the output location for the test scripts.
|
|
95
|
+
|
|
96
|
+
$ lemonade generate -Ilib test/cases/*.rb
|
|
97
|
+
|
|
98
|
+
Generating test case scaffolding from code will undoubtedly strike test-driven developers as a case of putting the cart before the horse. However, it is not unreasonable to argue that high-level, behavior-driven, functional testing frameworks, such as Q.E.D. and Cucumber are better suited to test-first methodologies. While test-driven development can obviously be done with Lemon, unit-testing is more appropriate for testing specific, critical portions of code, or for achieving full test coverage for mission critical applications.
|
|
99
|
+
|
|
100
|
+
### Test Directory
|
|
101
|
+
|
|
102
|
+
There is no special directory for Lemon tests. Since they are unit tests, `test/` or `test/unit/` are good choices. Other options are `cases/` and `test/cases` since each file generally defines a single test case.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## COPYRIGHTS
|
|
106
|
+
|
|
107
|
+
Lemon Unit Testing Framework
|
|
108
|
+
|
|
109
|
+
Copyright (c) 2009 Thomas Sawyer
|
|
110
|
+
|
|
111
|
+
Lemon is distributed according to the terms of the **FreeBSD** License.
|
|
112
|
+
|
|
113
|
+
See the COPYING.rdoc file for details.
|
data/Rakefile
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'test/rake'
|
|
4
|
+
|
|
5
|
+
Test::Rake::TestTask.new do |t|
|
|
6
|
+
t.libs << 'test/fixtures'
|
|
7
|
+
t.tests << 'test/*.rb'
|
|
8
|
+
end
|
|
9
|
+
|
|
1
10
|
namespace :test do
|
|
2
11
|
|
|
3
|
-
desc 'run lemon unit tests'
|
|
12
|
+
desc 'run lemon unit tests (via shell command)'
|
|
4
13
|
task :unit do
|
|
5
|
-
sh '
|
|
14
|
+
sh 'lemonade test -Itest/fixtures test/*.rb'
|
|
6
15
|
end
|
|
7
16
|
|
|
8
17
|
desc 'run qed demonstration tests'
|
|
9
18
|
task :qed do
|
|
10
|
-
sh 'qed'
|
|
19
|
+
sh 'qed -Ilib spec/'
|
|
11
20
|
end
|
|
12
21
|
|
|
13
22
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.9.0
|
data/bin/lemonade
ADDED
data/lib/lemon.rb
CHANGED
|
@@ -16,5 +16,55 @@ module Lemon
|
|
|
16
16
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
# Ruby Test standard location for test objects.
|
|
20
|
+
$TEST_SUITE ||= []
|
|
21
|
+
|
|
22
|
+
require 'lemon/test_class'
|
|
23
|
+
|
|
24
|
+
module Lemon
|
|
25
|
+
|
|
26
|
+
# Lemon's toplevel test domain specific language.
|
|
27
|
+
module DSL
|
|
28
|
+
|
|
29
|
+
# Require script and record it.
|
|
30
|
+
#
|
|
31
|
+
# @param [STRING] script
|
|
32
|
+
# The load path of a script.
|
|
33
|
+
#
|
|
34
|
+
def covers(script)
|
|
35
|
+
# TODO: record coverage list
|
|
36
|
+
require script
|
|
37
|
+
end
|
|
38
|
+
alias :Covers :covers
|
|
39
|
+
|
|
40
|
+
# Define a class/module test case.
|
|
41
|
+
#
|
|
42
|
+
# @param [Module,Class] target
|
|
43
|
+
# The class or module the tests will target.
|
|
44
|
+
#
|
|
45
|
+
# @yield
|
|
46
|
+
# Scope in which to define unit/method testcases.
|
|
47
|
+
#
|
|
48
|
+
def test_case(target, &block)
|
|
49
|
+
case target
|
|
50
|
+
when Class
|
|
51
|
+
$TEST_SUITE << Lemon::TestClass.new(:target=>target, &block)
|
|
52
|
+
when Module
|
|
53
|
+
$TEST_SUITE << Lemon::TestModule.new(:target=>target, &block)
|
|
54
|
+
else
|
|
55
|
+
if defined?(super)
|
|
56
|
+
super(target, &block)
|
|
57
|
+
else
|
|
58
|
+
raise
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
alias :TestCase :test_case
|
|
64
|
+
alias :testcase :test_case
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
extend Lemon::DSL
|