lemon 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require 'lemon/snapshot'
2
+ require 'lemon/coversheet/outline'
2
3
 
3
4
  module Lemon
4
5
 
@@ -92,10 +93,21 @@ module Lemon
92
93
  list
93
94
  end
94
95
 
95
- # #
96
- # def load_covered_files
97
- # suite.load_covered_files
98
- # end
96
+ #
97
+ def format(type)
98
+ coversheet = nil
99
+ case type
100
+ when :verbose
101
+ puts checklist.to_yaml
102
+ else
103
+ coversheet = CoverSheet::Outline.new(self)
104
+ coversheet.coverage_finished
105
+ end
106
+ end
107
+
108
+ #def load_covered_files
109
+ # suite.load_covered_files
110
+ #end
99
111
 
100
112
  # Iterate over +paths+ and use #load to bring in all +.rb+ scripts.
101
113
  #def load_system
@@ -110,18 +122,18 @@ module Lemon
110
122
  # files.each{ |file| load(file) }
111
123
  #end
112
124
 
113
- # # Snapshot of System to be covered. This takes a current snapshot
114
- # # of the system and removes the canonical snapshot or filters out
115
- # # everything but the selected namespace.
116
- # def system
117
- # if namespaces.empty?
118
- # snapshot - canonical
119
- # else
120
- # (snapshot - canonical).filter do |ofmod|
121
- # namespaces.any?{ |n| ofmod.name.start_with?(n.to_s) }
122
- # end
123
- # end
124
- # end
125
+ # # Snapshot of System to be covered. This takes a current snapshot
126
+ # # of the system and removes the canonical snapshot or filters out
127
+ # # everything but the selected namespace.
128
+ # def system
129
+ # if namespaces.empty?
130
+ # snapshot - canonical
131
+ # else
132
+ # (snapshot - canonical).filter do |ofmod|
133
+ # namespaces.any?{ |n| ofmod.name.start_with?(n.to_s) }
134
+ # end
135
+ # end
136
+ # end
125
137
 
126
138
  # List of modules/classes not covered.
127
139
  def uncovered_cases
@@ -165,6 +177,7 @@ module Lemon
165
177
  clist = clist | metameths
166
178
  end
167
179
  end
180
+
168
181
  @uncovered_units = clist - tlist
169
182
  @undefined_units = tlist - clist
170
183
  end
@@ -0,0 +1,60 @@
1
+ module Lemon
2
+ module CoverSheet
3
+
4
+ class Abstract
5
+
6
+ # Supports ANSI Codes?
7
+ ANSI_SUPPORT = (
8
+ begin
9
+ require 'ansi/code'
10
+ true
11
+ rescue LoadError
12
+ false
13
+ end
14
+ )
15
+
16
+ def initialize(coverage)
17
+ @coverage = coverage
18
+ @ansicolor = ANSI_SUPPORT
19
+ end
20
+
21
+ #
22
+ attr :coverage
23
+
24
+ def uncovered_cases
25
+ coverage.uncovered_cases
26
+ end
27
+
28
+ def uncovered_units
29
+ coverage.uncovered_units
30
+ end
31
+
32
+ def undefined_units
33
+ coverage.undefined_units
34
+ end
35
+
36
+ #
37
+ def red(string)
38
+ @ansicolor ? ANSI::Code.red{ string } : string
39
+ end
40
+
41
+ #
42
+ def yellow(string)
43
+ @ansicolor ? ANSI::Code.yellow{ string } : string
44
+ end
45
+
46
+ #
47
+ def green(string)
48
+ @ansicolor ? ANSI::Code.green{ string } : string
49
+ end
50
+
51
+ #
52
+ def tally
53
+ "#{uncovered_cases.size} uncovered cases, #{uncovered_units.size} uncovered units, #{undefined_units.size} undefined units"
54
+ end
55
+
56
+ end
57
+
58
+ end
59
+ end
60
+
@@ -0,0 +1,47 @@
1
+ require 'lemon/coversheet/abstract'
2
+
3
+ module Lemon
4
+ module CoverSheet
5
+
6
+ class Outline < Abstract
7
+
8
+ #
9
+ def coverage_finished
10
+
11
+ unless uncovered_cases.empty?
12
+ unc = uncovered_cases.map do |mod|
13
+ yellow(mod.name)
14
+ end.join(", ")
15
+ puts "\nUncovered Cases: " + unc
16
+ end
17
+
18
+ unless uncovered_units.empty?
19
+ unc = uncovered_units.map do |unit|
20
+ yellow(unit)
21
+ end.join(", ")
22
+ puts "\nUncovered Units: " + unc
23
+ end
24
+
25
+ #unless uncovered.empty?
26
+ # unc = uncovered.map do |unit|
27
+ # yellow(unit)
28
+ # end.join(", ")
29
+ # puts "\nUncovered: " + unc
30
+ #end
31
+
32
+ unless undefined_units.empty?
33
+ unc = undefined_units.map do |unit|
34
+ yellow(unit)
35
+ end.join(", ")
36
+ puts "\nUndefined Units: " + unc
37
+ end
38
+
39
+ puts
40
+ puts tally
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+ end
47
+
@@ -48,15 +48,15 @@ module Reporter
48
48
  def errors ; runner.errors ; end
49
49
  def pendings ; runner.pendings ; end
50
50
 
51
- def uncovered_cases ; runner.uncovered_cases ; end
52
- def uncovered_units ; runner.uncovered_units ; end
53
- def undefined_units ; runner.undefined_units ; end
51
+ #def uncovered_cases ; runner.uncovered_cases ; end
52
+ #def uncovered_units ; runner.uncovered_units ; end
53
+ #def undefined_units ; runner.undefined_units ; end
54
54
 
55
55
  #def uncovered ; runner.uncovered ; end
56
56
  #def undefined ; runner.undefined ; end
57
57
 
58
- # Is coverage information requested?
59
- def cover? ; runner.cover? ; end
58
+ ## Is coverage information requested?
59
+ #def cover? ; runner.cover? ; end
60
60
 
61
61
  #
62
62
  def red(string)
@@ -81,7 +81,7 @@ module Reporter
81
81
  #
82
82
  def tally
83
83
  s = "#{total} tests: #{successes.size} pass, #{failures.size} fail, #{errors.size} err, #{pendings.size} pending "
84
- s += "(#{uncovered_units.size} uncovered, #{undefined_units.size} undefined)" if cover?
84
+ #s += "(#{uncovered_units.size} uncovered, #{undefined_units.size} undefined)" if cover?
85
85
  s
86
86
  end
87
87
 
@@ -78,6 +78,7 @@ module Reporter
78
78
  # puts
79
79
  #end
80
80
 
81
+ =begin
81
82
  if cover?
82
83
 
83
84
  unless uncovered_cases.empty?
@@ -109,6 +110,7 @@ module Reporter
109
110
  end
110
111
 
111
112
  end
113
+ =end
112
114
 
113
115
  #total = successes.size + failures.size + errors.size + pendings.size
114
116
  #tally = "\n#{total} tests: #{successes.size} pass, #{failures.size} fail, #{errors.size} err, #{pendings.size} pending"
data/lib/lemon/runner.rb CHANGED
@@ -46,9 +46,9 @@ module Lemon
46
46
  end
47
47
 
48
48
  #
49
- def cover?
50
- @options[:cover]
51
- end
49
+ #def cover?
50
+ # @options[:cover]
51
+ #end
52
52
 
53
53
  # Namespaces option specifies the selection of test cases
54
54
  # to run. Is is an array of strings which are matched
@@ -139,6 +139,7 @@ module Lemon
139
139
  end
140
140
  =end
141
141
 
142
+ =begin
142
143
  #
143
144
  def uncovered_cases
144
145
  @uncovered_cases ||= coverage.uncovered_cases
@@ -153,6 +154,7 @@ module Lemon
153
154
  def undefined_units
154
155
  @undefined_units ||= coverage.undefined_units
155
156
  end
157
+ =end
156
158
 
157
159
  =begin
158
160
  #
@@ -247,10 +249,9 @@ module Lemon
247
249
  end
248
250
  end
249
251
 
250
- #
251
- def coverage
252
- @coverage ||= Lemon::Coverage.new(suite, namespaces) #, :public => public_only?)
253
- end
252
+ #def coverage
253
+ # @coverage ||= Lemon::Coverage.new(suite, namespaces) #, :public => public_only?)
254
+ #end
254
255
 
255
256
  =begin
256
257
  # TODO: I would think all this should be gained form the Coverage class.
@@ -63,6 +63,11 @@ module Test
63
63
  @options[:cover]
64
64
  end
65
65
 
66
+ #
67
+ def cover_all?
68
+ @options[:cover_all]
69
+ end
70
+
66
71
  #
67
72
  #def load_helpers(*files)
68
73
  # helpers = []
@@ -105,7 +110,11 @@ module Test
105
110
  #@current_file = file
106
111
  #file = File.expand_path(file)
107
112
  #instance_eval(File.read(file), file)
108
- require(file) #load(file)
113
+ if cover_all?
114
+ Covers(file)
115
+ else
116
+ require(file) #load(file)
117
+ end
109
118
  end
110
119
 
111
120
  #if cover?
@@ -1,3 +1,5 @@
1
+ Covers 'lemon/coverage'
2
+
1
3
  TestCase Lemon::Coverage do
2
4
 
3
5
  #Before /returns/ do |unit|
File without changes
@@ -0,0 +1,8 @@
1
+ Covers File.dirname(__FILE__) + '/example.rbx'
2
+ TestCase X do
3
+ Unit :a => "Returns a String" do
4
+ end
5
+ Unit :b => "Returns a String" do
6
+ end
7
+ end
8
+
@@ -0,0 +1,12 @@
1
+ Covers File.dirname(__FILE__) + '/example.rbx'
2
+
3
+ TestCase X do
4
+
5
+ Unit :a => "Returns a String" do
6
+ end
7
+
8
+ Unit :b => "Returns a String" do
9
+ end
10
+
11
+ end
12
+
@@ -0,0 +1,8 @@
1
+ class X
2
+ def a; "a"; end
3
+ def b; "b"; end
4
+ def c; "c"; end
5
+ end
6
+ class Y
7
+ def q; "q"; end
8
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lemon
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 63
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 7
8
+ - 8
8
9
  - 0
9
- version: 0.7.0
10
+ version: 0.8.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Thomas Sawyer
@@ -14,28 +15,99 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-06 00:00:00 -04:00
18
+ date: 2010-06-20 00:00:00 -04:00
18
19
  default_executable:
19
- dependencies: []
20
-
21
- description: |-
22
- Lemon is a unit testing framework that tightly correlates
23
- class to test case and method to test unit.
24
- email:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: syckle
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: box
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: cucumber
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: ae
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: aruba
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :development
90
+ version_requirements: *id005
91
+ description: Lemon is a unit testing framework that tightly correlates class to test case and method to test unit.
92
+ email: proutils@googlegroups.com
25
93
  executables:
26
94
  - lemon
27
95
  extensions: []
28
96
 
29
- extra_rdoc_files: []
30
-
97
+ extra_rdoc_files:
98
+ - README.rdoc
31
99
  files:
32
100
  - bin/lemon
33
- - lib/lemon/command/abstract.rb
34
- - lib/lemon/command/coverage.rb
35
- - lib/lemon/command/generate.rb
36
- - lib/lemon/command/test.rb
101
+ - features/coverage.feature
102
+ - features/generate.feature
103
+ - features/step_definitions/coverage_steps.rb
104
+ - features/support/ae.rb
105
+ - features/support/aruba.rb
106
+ - features/test.feature
37
107
  - lib/lemon/command.rb
38
108
  - lib/lemon/coverage.rb
109
+ - lib/lemon/coversheet/abstract.rb
110
+ - lib/lemon/coversheet/outline.rb
39
111
  - lib/lemon/dsl.rb
40
112
  - lib/lemon/kernel.rb
41
113
  - lib/lemon/reporter/abstract.rb
@@ -50,23 +122,17 @@ files:
50
122
  - lib/lemon/test/suite.rb
51
123
  - lib/lemon/test/unit.rb
52
124
  - lib/lemon.rb
53
- - meta/authors
54
- - meta/contact
55
- - meta/copyright
56
- - meta/description
57
- - meta/homepage
58
- - meta/license
59
- - meta/name
60
- - meta/repository
61
- - meta/suite
62
- - meta/summary
63
- - meta/title
64
- - meta/version
65
- - test/coverage_case.rb
66
- - test/testcase_case.rb
125
+ - test/case_coverage.rb
126
+ - test/case_testcase.rb
127
+ - test/fixtures/case_complete.rb
128
+ - test/fixtures/case_incomplete.rb
129
+ - test/fixtures/example.rb
130
+ - PROFILE
67
131
  - LICENSE
68
132
  - README.rdoc
69
133
  - HISTORY
134
+ - REQUIRE
135
+ - VERSION
70
136
  has_rdoc: true
71
137
  homepage: http://proutils.github.com/lemon
72
138
  licenses: []
@@ -75,29 +141,34 @@ post_install_message:
75
141
  rdoc_options:
76
142
  - --title
77
143
  - Lemon API
144
+ - --main
145
+ - README.rdoc
78
146
  require_paths:
79
147
  - lib
80
148
  required_ruby_version: !ruby/object:Gem::Requirement
149
+ none: false
81
150
  requirements:
82
151
  - - ">="
83
152
  - !ruby/object:Gem::Version
153
+ hash: 3
84
154
  segments:
85
155
  - 0
86
156
  version: "0"
87
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
+ none: false
88
159
  requirements:
89
160
  - - ">="
90
161
  - !ruby/object:Gem::Version
162
+ hash: 3
91
163
  segments:
92
164
  - 0
93
165
  version: "0"
94
166
  requirements: []
95
167
 
96
168
  rubyforge_project: lemon
97
- rubygems_version: 1.3.6
169
+ rubygems_version: 1.3.7
98
170
  signing_key:
99
171
  specification_version: 3
100
172
  summary: Pucker-tight Unit Testing
101
173
  test_files:
102
- - lib/lemon/command/test.rb
103
- - test/testcase_case.rb
174
+ - test/case_testcase.rb