lemon 0.8.5 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/{lemon.gemspec → .gemspec} +0 -0
  2. data/.ruby +4 -11
  3. data/Assembly +5 -11
  4. data/HISTORY.rdoc +31 -0
  5. data/MANIFEST +45 -55
  6. data/PROFILE +6 -6
  7. data/README.md +113 -0
  8. data/Rakefile +12 -3
  9. data/VERSION +1 -1
  10. data/bin/lemonade +8 -0
  11. data/lib/lemon.rb +52 -2
  12. data/lib/lemon.yml +4 -11
  13. data/lib/lemon/{model/ae.rb → ae.rb} +0 -0
  14. data/lib/lemon/cli.rb +28 -279
  15. data/lib/lemon/cli/base.rb +139 -0
  16. data/lib/lemon/cli/coverage.rb +52 -0
  17. data/lib/lemon/cli/generate.rb +51 -0
  18. data/lib/lemon/cli/test.rb +50 -0
  19. data/lib/lemon/core_ext.rb +7 -0
  20. data/lib/lemon/core_ext/kernel.rb +20 -0
  21. data/lib/lemon/core_ext/omission.rb +18 -0
  22. data/lib/lemon/{controller/coverage_analyzer.rb → coverage/analyzer.rb} +41 -19
  23. data/lib/lemon/{model → coverage}/cover_unit.rb +0 -0
  24. data/lib/lemon/{view/cover_reports → coverage/formats}/abstract.rb +0 -0
  25. data/lib/lemon/{view/cover_reports → coverage/formats}/compact.rb +1 -1
  26. data/lib/lemon/{view/cover_reports → coverage/formats}/outline.rb +1 -1
  27. data/lib/lemon/{view/cover_reports → coverage/formats}/verbose.rb +1 -1
  28. data/lib/lemon/{view/cover_reports → coverage/formats}/yaml.rb +1 -1
  29. data/lib/lemon/{model → coverage}/snapshot.rb +0 -0
  30. data/lib/lemon/{model → coverage}/source_parser.rb +0 -0
  31. data/lib/lemon/{controller/scaffold_generator.rb → generator.rb} +53 -14
  32. data/lib/lemon/test_advice.rb +63 -0
  33. data/lib/lemon/test_case.rb +270 -0
  34. data/lib/lemon/test_class.rb +28 -0
  35. data/lib/lemon/test_method.rb +207 -0
  36. data/lib/lemon/test_module.rb +114 -0
  37. data/lib/lemon/test_proc.rb +140 -0
  38. data/lib/lemon/test_setup.rb +54 -0
  39. data/lib/lemon/test_world.rb +9 -0
  40. data/notes/{2010-05-06-files_not_classes.rdoc → 2010-05-06-files-not-classes.rdoc} +0 -0
  41. data/notes/{2010-07-11-acid_testing.rdoc → 2010-07-11-acid-testing.rdoc} +0 -0
  42. data/notes/2011-07-07-nailing-down-the-nomenclature.md +6 -0
  43. data/site/index.html +7 -6
  44. data/{qed → spec}/applique/fs.rb +0 -0
  45. data/{qed → spec}/coverage/01_complete.rdoc +26 -16
  46. data/{qed → spec}/coverage/02_incomplete.rdoc +10 -7
  47. data/{qed → spec}/coverage/03_extensions.rdoc +10 -6
  48. data/spec/coverage/applique/lemon.rb +1 -0
  49. data/try/.test +8 -0
  50. data/try/case_error.rb +18 -0
  51. data/try/case_fail.rb +19 -0
  52. data/try/case_pass.rb +42 -0
  53. data/try/case_pending.rb +18 -0
  54. data/try/case_singleton.rb +18 -0
  55. data/try/case_untested.rb +14 -0
  56. data/try/fixtures/calculator.rb +15 -0
  57. data/{demo/fixture → try/fixtures}/example-use.rb +0 -0
  58. data/{demo/fixture → try/fixtures}/example.rb +0 -0
  59. data/try/helpers/loadpath.rb +1 -0
  60. data/{.config → work/deprecated}/cucumber.yml +0 -0
  61. data/{features → work/deprecated/features}/coverage.feature +0 -0
  62. data/{features → work/deprecated/features}/generate.feature +0 -0
  63. data/{features → work/deprecated/features}/step_definitions/coverage_steps.rb +0 -0
  64. data/{features → work/deprecated/features}/support/ae.rb +0 -0
  65. data/{features → work/deprecated/features}/support/aruba.rb +0 -0
  66. data/{features → work/deprecated/features}/test.feature +0 -0
  67. data/work/deprecated/model/dsl/advice.rb +78 -0
  68. data/work/deprecated/model/dsl/subject.rb +40 -0
  69. data/{lib/lemon → work/deprecated}/model/main.rb +40 -29
  70. data/work/deprecated/model/test.rb +54 -0
  71. data/work/deprecated/model/test_base_dsl.rb +88 -0
  72. data/work/deprecated/model/test_clause.rb +112 -0
  73. data/{lib/lemon → work/deprecated}/model/test_context.rb +24 -24
  74. data/work/deprecated/model/test_feature.rb +128 -0
  75. data/work/deprecated/model/test_scenario.rb +137 -0
  76. data/{lib/lemon → work/deprecated}/model/test_suite.rb +113 -32
  77. data/work/deprecated/rake.rb +103 -0
  78. data/{test → work/deprecated/test}/case_coverage_analyzer.rb +0 -0
  79. data/{test → work/deprecated/test}/case_test_case_dsl.rb +2 -2
  80. data/{test → work/deprecated/test}/fixtures/case_complete.rb +0 -0
  81. data/{test → work/deprecated/test}/fixtures/case_inclusion.rb +0 -0
  82. data/{test → work/deprecated/test}/fixtures/case_incomplete.rb +0 -0
  83. data/{test → work/deprecated/test}/fixtures/example.rb +0 -0
  84. data/{test → work/deprecated/test}/fixtures/helper.rb +0 -0
  85. data/{test → work/deprecated/test}/runner +0 -0
  86. data/work/old-tests/case_example.rb +15 -0
  87. data/work/old-tests/feature_example.rb +40 -0
  88. data/work/reference/dsl2.rb +4 -0
  89. metadata +101 -98
  90. data/README.rdoc +0 -103
  91. data/bin/lemon +0 -4
  92. data/demo/case_example_error.rb +0 -10
  93. data/demo/case_example_fail.rb +0 -15
  94. data/demo/case_example_pass.rb +0 -32
  95. data/demo/case_example_pending.rb +0 -14
  96. data/demo/case_example_untested.rb +0 -10
  97. data/lib/lemon/controller/test_runner.rb +0 -299
  98. data/lib/lemon/model/pending.rb +0 -10
  99. data/lib/lemon/model/test_case.rb +0 -305
  100. data/lib/lemon/model/test_unit.rb +0 -147
  101. data/lib/lemon/view/test_reports/abstract.rb +0 -256
  102. data/lib/lemon/view/test_reports/dotprogress.rb +0 -73
  103. data/lib/lemon/view/test_reports/html.rb +0 -146
  104. data/lib/lemon/view/test_reports/outline.rb +0 -118
  105. data/lib/lemon/view/test_reports/summary.rb +0 -131
  106. data/lib/lemon/view/test_reports/tap.rb +0 -49
  107. data/lib/lemon/view/test_reports/tapj.rb +0 -130
  108. data/lib/lemon/view/test_reports/tapy.rb +0 -141
  109. data/lib/lemon/view/test_reports/verbose.rb +0 -197
  110. data/work/sandbox/lib/sample.rb +0 -13
  111. data/work/sandbox/test/sample_case.rb +0 -12
  112. data/work/trash/example-cover.rb +0 -5
  113. data/work/trash/example.rb +0 -16
@@ -1,197 +0,0 @@
1
- require 'lemon/view/test_reports/abstract'
2
-
3
- module Lemon::TestReports
4
-
5
- # Timed Reporter
6
- class Verbose < Abstract
7
-
8
- LAYOUT = " %-12s %11s %11s %s %s"
9
-
10
- #
11
- def start_suite(suite)
12
- @start = Time.now
13
- timer_reset
14
- end
15
-
16
- #
17
- def start_case(tc)
18
- if @_last == :unit
19
- puts
20
- @_last = :case
21
- end
22
- puts tc.to_s.ansi(:bold)
23
- puts
24
- end
25
-
26
- #
27
- def context(context)
28
- unless context.to_s.empty?
29
- if @_last == :unit
30
- puts
31
- @_last = :context
32
- end
33
- puts " #{context}"
34
- puts
35
- end
36
- end
37
-
38
- #
39
- def start_unit(unit)
40
- if @context != unit.context
41
- @context = unit.context
42
- context(@context)
43
- end
44
- timer_reset
45
- end
46
-
47
- #
48
- def omit(unit)
49
- data = ["OMIT".ansi(:cyan), timer, clock, unit.name.ansi(:bold), unit.aspect]
50
- puts LAYOUT % data
51
- #puts " %s %s %s" % [" OMIT".ansi(:cyan), unit.to_s, unit.aspect]
52
- @_last = :unit
53
- end
54
-
55
- #
56
- def pass(unit)
57
- data = ["PASS".ansi(:green), timer, clock, unit.name.ansi(:bold), unit.aspect]
58
- puts LAYOUT % data
59
- end
60
-
61
- #
62
- def fail(unit, exception)
63
- data = ["FAIL".ansi(:red), timer, clock, unit.name.ansi(:bold), unit.aspect]
64
- puts LAYOUT % data
65
- #puts
66
- #puts " FAIL #{exception.backtrace[0]}"
67
- #puts " #{exception}"
68
- #puts
69
- end
70
-
71
- #
72
- def error(unit, exception)
73
- data = ["ERRS".ansi(:red, :bold), timer, clock, unit.name.ansi(:bold), unit.aspect]
74
- puts LAYOUT % data
75
- #puts
76
- #puts " ERROR #{exception.class}"
77
- #puts " #{exception}"
78
- #puts " " + exception.backtrace.join("\n ")
79
- #puts
80
- end
81
-
82
- #
83
- def pending(unit, exception)
84
- data = ["PEND".ansi(:yellow), timer, clock, unit.name.ansi(:bold), unit.aspect]
85
- puts LAYOUT % data
86
- end
87
-
88
- #
89
- def finish_unit(unit)
90
- @_last = :unit
91
- end
92
-
93
- #
94
- def finish_suite(suite)
95
- puts
96
-
97
- unless record[:omit].empty?
98
- puts "OMITTED:\n\n"
99
- puts record[:omit].map{ |u| u.to_s }.sort.join(' ')
100
- puts
101
- end
102
-
103
- unless record[:pending].empty?
104
- puts "PENDING:\n\n"
105
- record[:pending].each do |unit, exception|
106
- puts " #{unit}"
107
- puts " #{file_and_line(exception)}"
108
- puts
109
- end
110
- end
111
-
112
- unless record[:fail].empty?
113
- puts "FAILURES:\n\n"
114
- record[:fail].each do |unit, exception|
115
- puts " #{unit}"
116
- puts " #{file_and_line(exception)}"
117
- puts " #{exception}"
118
- puts code_snippet(exception)
119
- #puts " #{exception.backtrace[0]}"
120
- puts
121
- end
122
- end
123
-
124
- unless record[:error].empty?
125
- puts "ERRORS:\n\n"
126
- record[:error].each do |unit, exception|
127
- puts " #{unit}".ansi(:bold)
128
- puts " #{exception.class} @ #{file_and_line(exception)}"
129
- puts " #{exception}"
130
- puts code_snippet(exception)
131
- #puts " #{exception.backtrace[0]}"
132
- puts
133
- end
134
- end
135
-
136
- puts tally
137
- end
138
-
139
- #
140
- def clock
141
- secs = Time.now - @start
142
- return "%0.5fs" % [secs.to_s]
143
- end
144
-
145
- #
146
- def timer
147
- secs = Time.now - @time
148
- @time = Time.now
149
- return "%0.5fs" % [secs.to_s]
150
- end
151
-
152
- #
153
- def timer_reset
154
- @time = Time.now
155
- end
156
-
157
- end
158
-
159
- end
160
-
161
-
162
-
163
-
164
- =begin
165
- if cover?
166
-
167
- unless uncovered_cases.empty?
168
- unc = uncovered_cases.map do |mod|
169
- yellow(mod.name)
170
- end.join(", ")
171
- puts "\nUncovered Cases: " + unc
172
- end
173
-
174
- unless uncovered_units.empty?
175
- unc = uncovered_units.map do |unit|
176
- yellow(unit)
177
- end.join(", ")
178
- puts "\nUncovered Units: " + unc
179
- end
180
-
181
- #unless uncovered.empty?
182
- # unc = uncovered.map do |unit|
183
- # yellow(unit)
184
- # end.join(", ")
185
- # puts "\nUncovered: " + unc
186
- #end
187
-
188
- unless undefined_units.empty?
189
- unc = undefined_units.map do |unit|
190
- yellow(unit)
191
- end.join(", ")
192
- puts "\nUndefined Units: " + unc
193
- end
194
-
195
- end
196
- =end
197
-
@@ -1,13 +0,0 @@
1
- class X
2
-
3
- def a; "a"; end
4
- def b; "b"; end
5
- def c; "c"; end
6
-
7
- end
8
-
9
- class Y
10
-
11
- def q; "q"; end
12
-
13
- end
@@ -1,12 +0,0 @@
1
- Covers 'sample'
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
-
@@ -1,5 +0,0 @@
1
- require 'lemon/aid/example'
2
-
3
- ex = Example.new
4
- ex.f(1,2)
5
-
@@ -1,16 +0,0 @@
1
- class Example
2
-
3
- def self.m(a,b)
4
- a * b
5
- end
6
-
7
- def q(x,y)
8
- x % y
9
- end
10
-
11
- def f(x,y)
12
- x + y
13
- end
14
-
15
- end
16
-