lemon 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +23 -14
- data/.yardopts +6 -0
- data/Config.rb +14 -0
- data/{HISTORY.rdoc → HISTORY.md} +26 -11
- data/LICENSE.txt +27 -0
- data/README.md +42 -28
- data/SPECSHEET.md +314 -0
- data/bin/{lemonade → lemons} +0 -0
- data/lib/lemon.yml +23 -14
- data/lib/lemon/cli.rb +19 -8
- data/lib/lemon/cli/base.rb +50 -20
- data/lib/lemon/cli/generate.rb +51 -16
- data/lib/lemon/cli/lemon.ascii +84 -0
- data/lib/lemon/cli/obrother.rb +35 -0
- data/lib/lemon/cli/scaffold.rb +116 -0
- data/lib/lemon/core_ext.rb +2 -2
- data/lib/lemon/core_ext/module.rb +9 -0
- data/lib/lemon/coverage/analyzer.rb +76 -5
- data/lib/lemon/coverage/cover_unit.rb +38 -14
- data/lib/lemon/coverage/formats/verbose.rb +1 -1
- data/lib/lemon/coverage/generator.rb +196 -0
- data/lib/lemon/coverage/snapshot.rb +16 -16
- data/lib/lemon/coverage/source_parser.rb +103 -37
- data/lib/lemon/ignore_callers.rb +19 -0
- data/lib/lemon/test_case.rb +135 -26
- data/lib/lemon/test_class.rb +16 -3
- data/lib/lemon/test_class_method.rb +58 -0
- data/lib/lemon/test_method.rb +57 -68
- data/lib/lemon/test_module.rb +47 -44
- data/lib/lemon/test_proc.rb +28 -2
- data/lib/lemon/test_scope.rb +14 -0
- data/lib/lemon/test_setup.rb +1 -1
- data/lib/lemon/test_world.rb +7 -0
- data/{work/deprecated/features/support → spec/applique}/ae.rb +0 -0
- data/spec/coverage/{01_complete.rdoc → 01_complete.md} +3 -3
- data/spec/coverage/{02_incomplete.rdoc → 02_incomplete.md} +2 -2
- data/spec/coverage/{03_extensions.rdoc → 03_extensions.md} +2 -2
- data/try/case_scope.rb +19 -0
- metadata +50 -102
- data/.gemspec +0 -152
- data/.gitignore +0 -8
- data/.reap/digest +0 -678
- data/.reap/test.reap +0 -7
- data/Assembly +0 -37
- data/COPYING.rdoc +0 -33
- data/MANIFEST +0 -55
- data/PROFILE +0 -30
- data/Rakefile +0 -23
- data/VERSION +0 -1
- data/lib/lemon/core_ext/omission.rb +0 -18
- data/lib/lemon/generator.rb +0 -149
- data/notes/2010-05-05-coverage.rdoc +0 -47
- data/notes/2010-05-06-files-not-classes.rdoc +0 -19
- data/notes/2010-07-11-acid-testing.rdoc +0 -52
- data/notes/2010-08-02-enforcing-the-unit.md +0 -68
- data/notes/2010-08-03-new-api.md +0 -37
- data/notes/2011-07-07-nailing-down-the-nomenclature.md +0 -6
- data/site/.rsync-filter +0 -8
- data/site/assets/images/cut-lemon.png +0 -0
- data/site/assets/images/forkme.png +0 -0
- data/site/assets/images/github-logo.png +0 -0
- data/site/assets/images/lemon.jpg +0 -0
- data/site/assets/images/lemon.svg +0 -39
- data/site/assets/images/lemons-are-good.png +0 -0
- data/site/assets/images/opensource.png +0 -0
- data/site/assets/images/ruby-logo.png +0 -0
- data/site/assets/images/skin.jpg +0 -0
- data/site/assets/images/skin1.jpg +0 -0
- data/site/assets/images/tap.png +0 -0
- data/site/assets/images/title.png +0 -0
- data/site/assets/styles/class.css +0 -6
- data/site/assets/styles/reset.css +0 -17
- data/site/assets/styles/site.css +0 -33
- data/site/index.html +0 -218
- data/work/deprecated/command/abstract.rb +0 -29
- data/work/deprecated/command/coverage.rb +0 -115
- data/work/deprecated/command/generate.rb +0 -124
- data/work/deprecated/command/test.rb +0 -112
- data/work/deprecated/cucumber.yml +0 -3
- data/work/deprecated/features/coverage.feature +0 -65
- data/work/deprecated/features/generate.feature +0 -66
- data/work/deprecated/features/step_definitions/coverage_steps.rb +0 -1
- data/work/deprecated/features/support/aruba.rb +0 -1
- data/work/deprecated/features/test.feature +0 -67
- data/work/deprecated/model/dsl/advice.rb +0 -78
- data/work/deprecated/model/dsl/subject.rb +0 -40
- data/work/deprecated/model/main.rb +0 -87
- data/work/deprecated/model/test.rb +0 -54
- data/work/deprecated/model/test_base_dsl.rb +0 -88
- data/work/deprecated/model/test_clause.rb +0 -112
- data/work/deprecated/model/test_context.rb +0 -90
- data/work/deprecated/model/test_feature.rb +0 -128
- data/work/deprecated/model/test_scenario.rb +0 -137
- data/work/deprecated/model/test_suite.rb +0 -297
- data/work/deprecated/rake.rb +0 -103
- data/work/deprecated/test/case_coverage_analyzer.rb +0 -25
- data/work/deprecated/test/case_test_case_dsl.rb +0 -46
- data/work/deprecated/test/fixtures/case_complete.rb +0 -25
- data/work/deprecated/test/fixtures/case_inclusion.rb +0 -18
- data/work/deprecated/test/fixtures/case_incomplete.rb +0 -12
- data/work/deprecated/test/fixtures/example.rb +0 -13
- data/work/deprecated/test/fixtures/helper.rb +0 -13
- data/work/deprecated/test/runner +0 -2
- data/work/old-tests/case_example.rb +0 -15
- data/work/old-tests/feature_example.rb +0 -40
- data/work/reference/dsl2.rb +0 -140
- data/work/reference/dynamic_constant_lookup.rb +0 -76
@@ -1,25 +0,0 @@
|
|
1
|
-
covers 'example.rb'
|
2
|
-
|
3
|
-
testcase X do
|
4
|
-
|
5
|
-
unit :a => "Returns a String" do
|
6
|
-
X.new.a
|
7
|
-
end
|
8
|
-
|
9
|
-
unit :b => "Returns a String" do
|
10
|
-
X.new.b
|
11
|
-
end
|
12
|
-
|
13
|
-
unit :c => "Returns a String" do
|
14
|
-
X.new.c
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
testcase Y do
|
20
|
-
|
21
|
-
unit :q => "Returns a String" do
|
22
|
-
Y.new.q
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
data/work/deprecated/test/runner
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
Test::Feature "Addition" do
|
2
|
-
To "avoid silly mistakes"
|
3
|
-
As "a math idiot"
|
4
|
-
We "need to calculate the sum of numbers"
|
5
|
-
|
6
|
-
Scenario "Add two numbers" do
|
7
|
-
Given "I have a calculator"
|
8
|
-
Given "I have entered 50 into the calculator"
|
9
|
-
Given "I have entered 70 into the calculator"
|
10
|
-
When "I press add"
|
11
|
-
Then "the result should be 120 on the screen"
|
12
|
-
end
|
13
|
-
|
14
|
-
Scenario "Add three numbers" do
|
15
|
-
Given "I have a calculator"
|
16
|
-
Given "I have entered 50 into the calculator"
|
17
|
-
Given "I have entered 70 into the calculator"
|
18
|
-
Given "I have entered 90 into the calculator"
|
19
|
-
When "I press add"
|
20
|
-
Then "the result should be 210 on the screen"
|
21
|
-
end
|
22
|
-
|
23
|
-
Given 'I have a calculator' do
|
24
|
-
require 'calculator'
|
25
|
-
@calculator = Calculator.new
|
26
|
-
end
|
27
|
-
|
28
|
-
Given 'I have entered (((\d+))) into the calculator' do |n|
|
29
|
-
@calculator.push n.to_i
|
30
|
-
end
|
31
|
-
|
32
|
-
When 'I press add' do
|
33
|
-
@result = @calculator.add
|
34
|
-
end
|
35
|
-
|
36
|
-
Then 'the result should be (((\d+))) on the screen' do |n|
|
37
|
-
@result.assert == n.to_i
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
data/work/reference/dsl2.rb
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
require 'ae'
|
2
|
-
|
3
|
-
module Lemon
|
4
|
-
|
5
|
-
def self.suite
|
6
|
-
@suite ||= Suite.new(Runner.new(Reporter.new))
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.suite=(suite)
|
10
|
-
@suite = suite
|
11
|
-
end
|
12
|
-
|
13
|
-
class Context
|
14
|
-
def initialize(desc=nil)
|
15
|
-
@desc = desc
|
16
|
-
@before = {}
|
17
|
-
@after = {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def description
|
21
|
-
@desc
|
22
|
-
end
|
23
|
-
|
24
|
-
def before(which, &block)
|
25
|
-
@before[which] = block if block
|
26
|
-
@before[which]
|
27
|
-
end
|
28
|
-
|
29
|
-
def after(which, &block)
|
30
|
-
@after[which] = block if block
|
31
|
-
@after[which]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class Suite
|
36
|
-
def initialize(runner)
|
37
|
-
@runner = runner
|
38
|
-
end
|
39
|
-
|
40
|
-
def before(which, &block)
|
41
|
-
@runner.before(which, &block)
|
42
|
-
end
|
43
|
-
|
44
|
-
def after(which, &block)
|
45
|
-
@runner.after(which, &block)
|
46
|
-
end
|
47
|
-
|
48
|
-
def unit(mod, meth, desc=nil, &block)
|
49
|
-
@runner.unit(mod, meth, desc, &block)
|
50
|
-
end
|
51
|
-
|
52
|
-
def context(desc, &block)
|
53
|
-
@runner.context(desc, &block)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Runner is a listner.
|
58
|
-
class Runner
|
59
|
-
#
|
60
|
-
def initialize(*reporters)
|
61
|
-
@reporters = reporters
|
62
|
-
#@before = {} #Hash.new{|h,k| h[k]=[]}
|
63
|
-
#@after = {} #Hash.new{|h,k| h[k]=[]}
|
64
|
-
@context_stack = [Context.new]
|
65
|
-
end
|
66
|
-
|
67
|
-
def before(which, &block)
|
68
|
-
@context_stack.last.before(which, &block)
|
69
|
-
@reporters.each do |reporter|
|
70
|
-
reporter.before(which, &block)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def after(which, &block)
|
75
|
-
@context_stack.last.after(which, &block)
|
76
|
-
@reporters.each do |reporter|
|
77
|
-
reporter.after(which, &block)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def instance(desc, &block)
|
82
|
-
@instance = Context.new(desc, &block)
|
83
|
-
end
|
84
|
-
|
85
|
-
def unit(mod, meth, desc=nil, &block)
|
86
|
-
@reporters.each do |reporter|
|
87
|
-
reporter.unit(mod, meth, desc, &block)
|
88
|
-
end
|
89
|
-
|
90
|
-
if @instance && block.arity != 0
|
91
|
-
block.call(@instance.call)
|
92
|
-
else
|
93
|
-
block.call
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
class Reporter
|
100
|
-
#
|
101
|
-
def initialize
|
102
|
-
end
|
103
|
-
|
104
|
-
def before(which, &block)
|
105
|
-
end
|
106
|
-
|
107
|
-
def after(which, &block)
|
108
|
-
end
|
109
|
-
|
110
|
-
def unit(mod, meth, desc=nil, &block)
|
111
|
-
puts "%s#%s %s" % [mod.name, meth.to_s, desc]
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
#
|
119
|
-
def before(which, &block)
|
120
|
-
Lemon.suite.before(which, &block)
|
121
|
-
end
|
122
|
-
|
123
|
-
#
|
124
|
-
def after(which, &block)
|
125
|
-
Lemon.suite.after(which, &block)
|
126
|
-
end
|
127
|
-
|
128
|
-
# @example
|
129
|
-
# unit Example, :foo, "desciption" do
|
130
|
-
# ...
|
131
|
-
# end
|
132
|
-
#
|
133
|
-
def unit(mod, meth, desc=nil, &blk)
|
134
|
-
Lemon.suite.unit(mod, meth, desc, &blk)
|
135
|
-
end
|
136
|
-
|
137
|
-
def context(desc, &block)
|
138
|
-
Lemon.suite.context(desc, &block)
|
139
|
-
end
|
140
|
-
|
@@ -1,76 +0,0 @@
|
|
1
|
-
#
|
2
|
-
module M
|
3
|
-
def m1; "m1"; end
|
4
|
-
module N
|
5
|
-
def self.n1; "n1"; end
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class X
|
10
|
-
class << self
|
11
|
-
alias _new new
|
12
|
-
def new(&block)
|
13
|
-
klass = Class.new(self)
|
14
|
-
klass.module_eval(&block)
|
15
|
-
klass._new
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def m ; m1 ; end
|
20
|
-
def n ; N.n1 ; end
|
21
|
-
end
|
22
|
-
|
23
|
-
x = X.new do
|
24
|
-
include M
|
25
|
-
end
|
26
|
-
|
27
|
-
p x.m
|
28
|
-
p x.n
|
29
|
-
|
30
|
-
|
31
|
-
exit
|
32
|
-
|
33
|
-
class X
|
34
|
-
attr :set
|
35
|
-
def initialize(&block)
|
36
|
-
@set = {}
|
37
|
-
instance_eval(&block)
|
38
|
-
end
|
39
|
-
def defset(name, &block)
|
40
|
-
@set[name] = block
|
41
|
-
end
|
42
|
-
def include(*mods)
|
43
|
-
(class << self; self; end).class_eval do
|
44
|
-
include *mods
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
module M
|
51
|
-
def m1; "m1"; end
|
52
|
-
module N
|
53
|
-
def self.n1; "n1"; end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
x = X.new do
|
58
|
-
|
59
|
-
include M
|
60
|
-
|
61
|
-
#Before /returns/ do |unit|
|
62
|
-
# puts "returns something"
|
63
|
-
#end
|
64
|
-
|
65
|
-
defset :m do
|
66
|
-
m1 == "m1"
|
67
|
-
end
|
68
|
-
|
69
|
-
defset :n do
|
70
|
-
N.n1 == "n1"
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
x.set[:m].call
|
76
|
-
x.set[:n].call
|