lemon 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.rdoc ADDED
@@ -0,0 +1,64 @@
1
+ = RELEASE HISTORY
2
+
3
+ == 0.8.1 / 2010-07-11
4
+
5
+ This release adds a timer to the verbose output, which help isolate unit tests
6
+ that are slow. It also fixed bug in Before and After advice that prevented them
7
+ from triggering correctly.
8
+
9
+ Changes:
10
+
11
+ * Add times to verbose reporter.
12
+
13
+
14
+ == 0.8.0 / 2010-06-21
15
+
16
+ This release removes coverage information from testing. Coverage can be time
17
+ consuming, but running test should be as fast as possbile. For this reason
18
+ coverage and testing are kept two independent activities. This release also
19
+ adds some test coverage for Lemon itself via Cucumber.
20
+
21
+ Changes:
22
+
23
+ * Separated coverage from testing completely.
24
+ * Test generator defaults to public methods only.
25
+
26
+
27
+ == 0.7.0 / 2010-05-04
28
+
29
+ This release fixes issue with coverage reports. To do this we have interoduced
30
+ the +Covers+ method. This allows Lemon to distingush between code that is
31
+ inteded to be covered by the tests and mere support code.
32
+
33
+ Keep in mind that there is no perfect way to handle coverage. Even with the
34
+ distiction the +Covers+ method provides, coverage might not be reported exactly
35
+ as desired. Other techinques can be used to refine coverage however, such
36
+ a preloading embedded support libraries.
37
+
38
+ Changes:
39
+
40
+ * Add +Covers+ method to solidify coverage reporting.
41
+ * New Snapshot class improves encapsulation to coverage state.
42
+
43
+
44
+ == 0.6.0 / 2010-03-06
45
+
46
+ This release adds coverage reporting to testing and improves the generator.
47
+
48
+ Changes:
49
+
50
+ * Runner can provide uncovered and undefined testunit list.
51
+ * Generator can exclude already covered testunits with -u option.
52
+ * Suite class has Coverage instance.
53
+
54
+
55
+ == 0.5.0 / 2009-12-31
56
+
57
+ This is the initial public release of Lemon. Lemon is still under development
58
+ and should be considered betaware, but it's API is stable and the system usable
59
+ enough to warrant a release.
60
+
61
+ Changes:
62
+
63
+ * Happy First Release Day!
64
+
data/README.rdoc CHANGED
@@ -21,7 +21,7 @@ Say our library 'mylib.rb' consists of the class X:
21
21
  def a; "a"; end
22
22
  end
23
23
 
24
- The simplist test case would be written as follows:
24
+ The simplest test case would be written as follows:
25
25
 
26
26
  Covers 'mylib'
27
27
 
@@ -32,7 +32,7 @@ The simplist test case would be written as follows:
32
32
  end
33
33
  end
34
34
 
35
- The +Covers+ method works just like +require+ with the exception that loading the file does not occur until just before the tests are run. This allows Lemon to cacluate accurate coverage reports.
35
+ The +Covers+ method works just like +require+ with the exception that loading the file does not occur until just before the tests are run. This allows Lemon to calculate accurate coverage reports.
36
36
 
37
37
  As tests grow, we might need to organize them into special concerns. For this Lemon provides the #Concern method.
38
38
 
@@ -59,17 +59,17 @@ Normal output is typical <i>dot-progress</i>. For verbose output, use the <code>
59
59
 
60
60
  === Checking Test Coverage
61
61
 
62
- Lemon can check test coverage by loading your target system and comparing it to your tests. To do this suppy the <code>lemon</code> command the <code>--coverage</code> or <code>-c</code> option.
62
+ Lemon can check test coverage by loading your target system and comparing it to your tests. To do this supply the <code>lemon</code> command the <code>--coverage</code> or <code>-c</code> option.
63
63
 
64
64
  $ lemon --coverage -Ilib test/cases/
65
65
 
66
66
  === Generating Test Skeletons
67
67
 
68
- Because of the one to one correspondance of case-unit to class-method, Lemon can also generate test scaffolding for previously written code. To do this, use the <code>--generate</code> or <code>-g</code> option and provide the lib location, or files, of the scripts for which to generate test scaffolding, and the output location for the test scripts.
68
+ Because of the one to one correspondence of case-unit to class-method, Lemon can also generate test scaffolding for previously written code. To do this, use the <code>--generate</code> or <code>-g</code> option and provide the lib location, or files, of the scripts for which to generate test scaffolding, and the output location for the test scripts.
69
69
 
70
70
  $ lemon --generate -Ilib test/cases/
71
71
 
72
- Generating test case scaffodling 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 protions of code, or for achieving full test coverage for mission critical applications.
72
+ 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.
73
73
 
74
74
 
75
75
  == COPYRIGHT
data/VERSION CHANGED
@@ -2,5 +2,5 @@
2
2
  name : lemon
3
3
  major: 0
4
4
  minor: 8
5
- patch: 0
6
- date : 2010-06-21
5
+ patch: 1
6
+ date : 2010-07-10
data/lib/lemon/dsl.rb CHANGED
@@ -52,7 +52,7 @@ end
52
52
  #
53
53
  # This sucks and it is not thread safe. If anyone know how to fix,
54
54
  # please let me know. See Unit#call for the other end of this hack.
55
-
55
+ #
56
56
  def Object.const_missing(name)
57
57
  if unit = Lemon.test_stack.last
58
58
  begin
@@ -65,6 +65,16 @@ def Object.const_missing(name)
65
65
  end
66
66
  end
67
67
 
68
+ #def Object.const_missing(name)
69
+ # if unit = Lemon.test_stack.last
70
+ # klass = (class << unit.testcase; self; end)
71
+ # if klass.const_defined?(name)
72
+ # return klass.const_get(name)
73
+ # end
74
+ # end
75
+ # super(name)
76
+ #end
77
+
68
78
  # Get current running test. Used for the BIG FAT HACK.
69
79
  def Lemon.test_stack
70
80
  @@test_stack ||= []
@@ -73,6 +73,11 @@ module Reporter
73
73
  @ansicolor ? ANSI::Code.green{ string } : string
74
74
  end
75
75
 
76
+ #
77
+ def cyan(string)
78
+ @ansicolor ? ANSI::Code.cyan{ string } : string
79
+ end
80
+
76
81
  #
77
82
  def total
78
83
  successes.size + failures.size + errors.size + pendings.size
@@ -7,22 +7,24 @@ module Reporter
7
7
 
8
8
  #
9
9
  def report_start(suite)
10
+ timer_reset
10
11
  end
11
12
 
12
13
  #
13
14
  def report_concern(concern)
14
15
  puts
15
- puts "#{concern.description}\n\n" unless concern.description.empty?
16
+ puts "== #{concern.description}\n\n" unless concern.description.empty?
17
+ timer_reset
16
18
  end
17
19
 
18
20
  #
19
21
  def report_success(testunit)
20
- puts green("* #{testunit}")
22
+ puts "%12s %s %s" % [timer, green("SUCCESS"), green("#{testunit}")]
21
23
  end
22
24
 
23
25
  #
24
26
  def report_failure(testunit, exception)
25
- puts red("* #{testunit} (FAILURE)")
27
+ puts "%12s %s %s" % [timer, red("FAILURE"), red("#{testunit}")]
26
28
  puts
27
29
  puts " FAIL #{exception.backtrace[0]}"
28
30
  puts " #{exception}"
@@ -31,7 +33,7 @@ module Reporter
31
33
 
32
34
  #
33
35
  def report_error(testunit, exception)
34
- puts red("* #{testunit} (ERROR)")
36
+ puts "%12s %s %s" % [timer, red("ERRORED"), red("#{testunit}")]
35
37
  puts
36
38
  puts " ERROR #{exception.backtrace[0]}"
37
39
  puts " #{exception}"
@@ -40,7 +42,7 @@ module Reporter
40
42
 
41
43
  #
42
44
  def report_pending(testunit, exception)
43
- puts yellow("* #{testunit} (PENDING)")
45
+ puts "%12s %s %s" % [timer, yellow("PENDING"), yellow("#{testunit}")]
44
46
  #puts
45
47
  #puts " PENDING #{exception.backtrace[1]}"
46
48
  #puts
@@ -122,6 +124,18 @@ module Reporter
122
124
  puts tally
123
125
  end
124
126
 
127
+ #
128
+ def timer
129
+ secs = Time.now - @time
130
+ @time = Time.now
131
+ return "%0.5fs" % [secs.to_s]
132
+ end
133
+
134
+ #
135
+ def timer_reset
136
+ @time = Time.now
137
+ end
138
+
125
139
  end
126
140
 
127
141
  end
@@ -97,7 +97,7 @@ module Lemon::Test
97
97
 
98
98
  # Define a before procedure for this case.
99
99
  def Before(*matches, &block)
100
- matches == [nil] if matches.empty?
100
+ matches = [nil] if matches.empty?
101
101
  matches.each do |match|
102
102
  @before_clauses[match] = block #<< Advice.new(match, &block)
103
103
  end
@@ -107,7 +107,7 @@ module Lemon::Test
107
107
 
108
108
  # Define an after procedure for this case.
109
109
  def After(*matches, &block)
110
- matches == [nil] if matches.empty?
110
+ matches = [nil] if matches.empty?
111
111
  matches.each do |match|
112
112
  @after_clauses[match] = block #<< Advice.new(match, &block)
113
113
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lemon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 0
10
- version: 0.8.0
9
+ - 1
10
+ version: 0.8.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Sawyer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-20 00:00:00 -04:00
18
+ date: 2010-07-11 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -127,10 +127,10 @@ files:
127
127
  - test/fixtures/case_complete.rb
128
128
  - test/fixtures/case_incomplete.rb
129
129
  - test/fixtures/example.rb
130
+ - HISTORY.rdoc
130
131
  - PROFILE
131
132
  - LICENSE
132
133
  - README.rdoc
133
- - HISTORY
134
134
  - REQUIRE
135
135
  - VERSION
136
136
  has_rdoc: true
data/HISTORY DELETED
@@ -1,43 +0,0 @@
1
- = RELEASE HISTORY
2
-
3
- == 0.8.0 / 2010-06-21
4
-
5
- This release removes coverage information from testing. Coverage can be time consuming, but running test should be as fast as possbile. For this reason coverage and testing are kept two independent activities. This release also adds some test coverage for Lemon itself via Cucumber.
6
-
7
- Changes:
8
-
9
- * Separated coverage from testing completely.
10
- * Test generator defaults to public methods only.
11
-
12
-
13
- == 0.7.0 / 2010-05-04
14
-
15
- This release fixes issue with coverage reports. To do this we have interoduced the +Covers+ method. This allows Lemon to distingush between code that is inteded to be covered by the tests and mere support code.
16
-
17
- Keep in mind that there is no perfect way to handle coverage. Even with the distiction the +Covers+ method provides, coverage might not be reported exactly as desired. Other techinques can be used to refine coverage however, such a preloading embedded support libraries.
18
-
19
- Changes:
20
-
21
- * Add +Covers+ method to solidify coverage reporting.
22
- * New Snapshot class improves encapsulation to coverage state.
23
-
24
-
25
- == 0.6.0 / 2010-03-06
26
-
27
- This release adds coverage reporting to testing and improves the generator.
28
-
29
- Changes:
30
-
31
- * Runner can provide uncovered and undefined testunit list.
32
- * Generator can exclude already covered testunits with -u option.
33
- * Suite class has Coverage instance.
34
-
35
-
36
- == 0.5.0 / 2009-12-31
37
-
38
- This is the initial public release of Lemon. Lemon is still under development and should be considered betaware, but it's API is stable and the system usable enough to warrant a release.
39
-
40
- Changes:
41
-
42
- * Happy First Release Day!
43
-