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/lib/lemon/model/pending.rb
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
require 'lemon/model/pending'
|
|
2
|
-
require 'lemon/model/test_context'
|
|
3
|
-
require 'lemon/model/test_unit'
|
|
4
|
-
|
|
5
|
-
module Lemon
|
|
6
|
-
|
|
7
|
-
# Test Case encapsulates a collection of
|
|
8
|
-
# unit tests organized into groups of contexts.
|
|
9
|
-
class TestCase
|
|
10
|
-
|
|
11
|
-
# The test suite to which this testcase belongs.
|
|
12
|
-
attr :suite
|
|
13
|
-
|
|
14
|
-
# A testcase +target+ is a class or module.
|
|
15
|
-
attr :target
|
|
16
|
-
|
|
17
|
-
# Description of the aspect of the test class/module
|
|
18
|
-
# to be testd.
|
|
19
|
-
attr :aspect
|
|
20
|
-
|
|
21
|
-
# Ordered list of testunits.
|
|
22
|
-
attr :units
|
|
23
|
-
|
|
24
|
-
# Before matching test units.
|
|
25
|
-
attr :before
|
|
26
|
-
#attr_accessor :prepare
|
|
27
|
-
|
|
28
|
-
# After matching test units.
|
|
29
|
-
attr :after
|
|
30
|
-
#attr_accessor :cleanup
|
|
31
|
-
|
|
32
|
-
# Module for parsing test case scripts.
|
|
33
|
-
attr :dsl
|
|
34
|
-
|
|
35
|
-
# A test case +target+ is a class or module.
|
|
36
|
-
def initialize(suite, target, aspect=nil, &block)
|
|
37
|
-
@suite = suite
|
|
38
|
-
@target = target
|
|
39
|
-
@aspect = aspect
|
|
40
|
-
|
|
41
|
-
#@steps = []
|
|
42
|
-
@units = []
|
|
43
|
-
|
|
44
|
-
#@prepare = nil
|
|
45
|
-
#@cleanup = nil
|
|
46
|
-
|
|
47
|
-
@before = {}
|
|
48
|
-
@after = {}
|
|
49
|
-
|
|
50
|
-
@dsl = DSL.new(self, &block)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# DEPRECATE
|
|
54
|
-
alias_method :testunits, :units
|
|
55
|
-
|
|
56
|
-
# Iterate over each test unit.
|
|
57
|
-
def each(&block)
|
|
58
|
-
units.each(&block)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
#
|
|
62
|
-
def size
|
|
63
|
-
testunits.size
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
#
|
|
67
|
-
def to_s
|
|
68
|
-
target.to_s.sub(/^\#\<.*?\>::/, '')
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
#
|
|
72
|
-
def prepare
|
|
73
|
-
@before[[]]
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
#
|
|
77
|
-
def cleanup
|
|
78
|
-
@after[[]]
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
#
|
|
82
|
-
class DSL < Module
|
|
83
|
-
#
|
|
84
|
-
def initialize(testcase, &casecode)
|
|
85
|
-
@testcase = testcase
|
|
86
|
-
@context = nil #Instance.new(self)
|
|
87
|
-
module_eval(&casecode)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# Define a unit test for this case.
|
|
91
|
-
#
|
|
92
|
-
# @example
|
|
93
|
-
# unit :puts => "print message with new line to stdout" do
|
|
94
|
-
# puts "Hello"
|
|
95
|
-
# end
|
|
96
|
-
#
|
|
97
|
-
def unit(*target, &block)
|
|
98
|
-
target = target.map{ |x| Hash === x ? x.to_a : x }.flatten
|
|
99
|
-
method, aspect = *target
|
|
100
|
-
unit = TestUnit.new(
|
|
101
|
-
@testcase, method,
|
|
102
|
-
:function => false,
|
|
103
|
-
:aspect => aspect,
|
|
104
|
-
:context => @context,
|
|
105
|
-
:caller => caller,
|
|
106
|
-
&block
|
|
107
|
-
)
|
|
108
|
-
#@testcase.steps << unit
|
|
109
|
-
@testcase.units << unit
|
|
110
|
-
unit
|
|
111
|
-
end
|
|
112
|
-
alias_method :TestUnit, :unit
|
|
113
|
-
alias_method :testunit, :unit
|
|
114
|
-
alias_method :Unit, :unit
|
|
115
|
-
|
|
116
|
-
# Define a meta-method unit test for this case.
|
|
117
|
-
def meta(*target, &block)
|
|
118
|
-
target = target.map{ |x| Hash === x ? x.to_a : x }.flatten
|
|
119
|
-
method, aspect = *target
|
|
120
|
-
unit = TestUnit.new(
|
|
121
|
-
@testcase, method,
|
|
122
|
-
:function => true,
|
|
123
|
-
:aspect => aspect,
|
|
124
|
-
:context => @context,
|
|
125
|
-
:caller => caller,
|
|
126
|
-
&block
|
|
127
|
-
)
|
|
128
|
-
#@testcase.steps << unit
|
|
129
|
-
@testcase.units << unit
|
|
130
|
-
unit
|
|
131
|
-
end
|
|
132
|
-
alias_method :MetaUnit, :meta
|
|
133
|
-
alias_method :metaunit, :meta
|
|
134
|
-
alias_method :Meta, :meta
|
|
135
|
-
|
|
136
|
-
# Omit a unit from testing.
|
|
137
|
-
#
|
|
138
|
-
# omit unit :foo do
|
|
139
|
-
# # ...
|
|
140
|
-
# end
|
|
141
|
-
#
|
|
142
|
-
def Omit(unit)
|
|
143
|
-
unit.omit = true
|
|
144
|
-
end
|
|
145
|
-
alias_method :omit, :Omit
|
|
146
|
-
|
|
147
|
-
# Setup is used to set things up for each unit test.
|
|
148
|
-
# The setup procedure is run before each unit.
|
|
149
|
-
#
|
|
150
|
-
# @param [String] description
|
|
151
|
-
# A brief description of what the setup procedure sets-up.
|
|
152
|
-
#
|
|
153
|
-
def setup(description=nil, &procedure)
|
|
154
|
-
if procedure
|
|
155
|
-
context = TestContext.new(@testcase, description, &procedure)
|
|
156
|
-
@context = context
|
|
157
|
-
#@function = false
|
|
158
|
-
#@testcase.steps << context
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
alias_method :Setup, :setup
|
|
162
|
-
alias_method :Concern, :setup
|
|
163
|
-
alias_method :concern, :setup
|
|
164
|
-
|
|
165
|
-
# @deprecate This alias will probably not stick around.
|
|
166
|
-
alias_method :Context, :setup
|
|
167
|
-
alias_method :context, :setup
|
|
168
|
-
|
|
169
|
-
=begin
|
|
170
|
-
# TODO: Currently there is no difference between Setup, Instance and Singleton
|
|
171
|
-
|
|
172
|
-
## Define a new test instance for this case.
|
|
173
|
-
def instance(description=nil, &block)
|
|
174
|
-
if block
|
|
175
|
-
#context = TestInstance.new(@testcase, description, &block)
|
|
176
|
-
context = TestContext.new(@testcase, description, &block)
|
|
177
|
-
else
|
|
178
|
-
context = TestContext.new(@testcase, description) do
|
|
179
|
-
@testcase.target.new # No arguments!!!
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
@context = context
|
|
183
|
-
#@function = false
|
|
184
|
-
#@testcase.steps << context
|
|
185
|
-
end
|
|
186
|
-
alias_method :Instance, :instance
|
|
187
|
-
|
|
188
|
-
# Define a new test singleton for this case.
|
|
189
|
-
def Singleton(description=nil, &block)
|
|
190
|
-
if block
|
|
191
|
-
#context = TestSingleton.new(@testcase, description, &block)
|
|
192
|
-
context = TestContext.new(@testcase, description, &block)
|
|
193
|
-
else
|
|
194
|
-
context = TestContext.new(@testcase, description){ @testcase.target }
|
|
195
|
-
end
|
|
196
|
-
@context = context
|
|
197
|
-
#@function = true
|
|
198
|
-
#@testcase.steps << context
|
|
199
|
-
end
|
|
200
|
-
alias_method :singleton, :Singleton
|
|
201
|
-
=end
|
|
202
|
-
|
|
203
|
-
# Teardown procedure is used to clean-up after each unit test.
|
|
204
|
-
def teardown(&procedure)
|
|
205
|
-
@context.teardown = procedure
|
|
206
|
-
end
|
|
207
|
-
alias_method :Teardown, :teardown
|
|
208
|
-
|
|
209
|
-
# TODO: Make Before and After more generic to handle before and after
|
|
210
|
-
# units, contexts/concerns, etc?
|
|
211
|
-
|
|
212
|
-
# Define a _complex_ before procedure. The #before method allows
|
|
213
|
-
# before procedures to be defined that are triggered by a match
|
|
214
|
-
# against the unit's target method name or _aspect_ description.
|
|
215
|
-
# This allows groups of tests to be defined that share special
|
|
216
|
-
# setup code.
|
|
217
|
-
#
|
|
218
|
-
# @example
|
|
219
|
-
#
|
|
220
|
-
# unit :puts => "standard output (@stdout)" do
|
|
221
|
-
# puts "Hello"
|
|
222
|
-
# end
|
|
223
|
-
#
|
|
224
|
-
# before /@stdout/ do
|
|
225
|
-
# $stdout = StringIO.new
|
|
226
|
-
# end
|
|
227
|
-
#
|
|
228
|
-
# after /@stdout/ do
|
|
229
|
-
# $stdout = STDOUT
|
|
230
|
-
# end
|
|
231
|
-
#
|
|
232
|
-
# @param [Array<Symbol,Regexp>] matches
|
|
233
|
-
# List of match critera that must _all_ be matched
|
|
234
|
-
# to trigger the before procedure.
|
|
235
|
-
#
|
|
236
|
-
def before(*matches, &procedure)
|
|
237
|
-
@testcase.before[matches] = procedure
|
|
238
|
-
end
|
|
239
|
-
alias_method :Before, :before
|
|
240
|
-
|
|
241
|
-
# Define a _complex_ after procedure. The #before method allows
|
|
242
|
-
# before procedures to be defined that are triggered by a match
|
|
243
|
-
# against the unit's target method name or _aspect_ description.
|
|
244
|
-
# This allows groups of tests to be defined that share special
|
|
245
|
-
# teardown code.
|
|
246
|
-
#
|
|
247
|
-
# @example
|
|
248
|
-
#
|
|
249
|
-
# unit :puts => "standard output (@stdout)" do
|
|
250
|
-
# puts "Hello"
|
|
251
|
-
# end
|
|
252
|
-
#
|
|
253
|
-
# before /@stdout/ do
|
|
254
|
-
# $stdout = StringIO.new
|
|
255
|
-
# end
|
|
256
|
-
#
|
|
257
|
-
# after /@stdout/ do
|
|
258
|
-
# $stdout = STDOUT
|
|
259
|
-
# end
|
|
260
|
-
#
|
|
261
|
-
# @param [Array<Symbol,Regexp>] matches
|
|
262
|
-
# List of match critera that must _all_ be matched
|
|
263
|
-
# to trigger the after procedure.
|
|
264
|
-
#
|
|
265
|
-
def after(*matches, &procedure)
|
|
266
|
-
@testcase.after[matches] = procedure
|
|
267
|
-
end
|
|
268
|
-
alias_method :After, :after
|
|
269
|
-
|
|
270
|
-
# Define a "before all" procedure.
|
|
271
|
-
def prepare(&procedure)
|
|
272
|
-
before(&procedure)
|
|
273
|
-
end
|
|
274
|
-
alias_method :Prepare, :prepare
|
|
275
|
-
|
|
276
|
-
# Define an "after all" procedure.
|
|
277
|
-
def cleanup(&procedure)
|
|
278
|
-
after(&procedure)
|
|
279
|
-
end
|
|
280
|
-
alias_method :Cleanup, :cleanup
|
|
281
|
-
|
|
282
|
-
# Load a helper script applicable to this test case. Unlike requiring
|
|
283
|
-
# a helper script, the #helper method will eval the file's contents
|
|
284
|
-
# directly into the test context (using instance_eval).
|
|
285
|
-
#
|
|
286
|
-
# @param [String] file
|
|
287
|
-
# File to eval into test context.
|
|
288
|
-
#
|
|
289
|
-
def helper(file)
|
|
290
|
-
instance_eval(File.read(file), file)
|
|
291
|
-
end
|
|
292
|
-
alias_method :Helper, :helper
|
|
293
|
-
|
|
294
|
-
#def include(*mods)
|
|
295
|
-
# extend *mods
|
|
296
|
-
#end
|
|
297
|
-
|
|
298
|
-
#def pending(message=nil)
|
|
299
|
-
# raise Pending.new(message)
|
|
300
|
-
#end
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
end
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
module Lemon
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
class TestUnit
|
|
5
|
-
|
|
6
|
-
# The test case to which this unit test belongs.
|
|
7
|
-
attr :testcase
|
|
8
|
-
|
|
9
|
-
# The context to use for this test.
|
|
10
|
-
attr :context
|
|
11
|
-
|
|
12
|
-
# A test unit +target+ is a method.
|
|
13
|
-
attr :target
|
|
14
|
-
|
|
15
|
-
# The aspect of the instance this test fulfills.
|
|
16
|
-
attr :aspect
|
|
17
|
-
|
|
18
|
-
# Test procedure, in which test assertions should be made.
|
|
19
|
-
attr :procedure
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
attr :caller
|
|
23
|
-
|
|
24
|
-
# New unit test.
|
|
25
|
-
def initialize(testcase, target, options={}, &procedure)
|
|
26
|
-
@testcase = testcase
|
|
27
|
-
@target = target
|
|
28
|
-
|
|
29
|
-
@aspect = options[:aspect]
|
|
30
|
-
@function = options[:function] || options[:metaclass]
|
|
31
|
-
@context = options[:context]
|
|
32
|
-
@omit = options[:omit]
|
|
33
|
-
@caller = options[:caller]
|
|
34
|
-
|
|
35
|
-
@procedure = procedure
|
|
36
|
-
|
|
37
|
-
@tested = false
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
attr_accessor :omit
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
def name ; @target ; end
|
|
45
|
-
|
|
46
|
-
# Is this unit test for a class or module level method?
|
|
47
|
-
def function?
|
|
48
|
-
@function
|
|
49
|
-
end
|
|
50
|
-
alias_method :meta?, :function?
|
|
51
|
-
|
|
52
|
-
#
|
|
53
|
-
def omit?
|
|
54
|
-
@omit
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
attr_accessor :tested
|
|
59
|
-
|
|
60
|
-
# The suite to which this unit test belongs.
|
|
61
|
-
def suite
|
|
62
|
-
testcase.suite
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# If meta-method return target method's name prefixed with double colons.
|
|
66
|
-
# If instance method then return target method's name.
|
|
67
|
-
def key
|
|
68
|
-
meta? ? "::#{target}" : "#{target}"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# If meta-method return target method's name prefixed with double colons.
|
|
72
|
-
# If instance method then return target method's name prefixed with hash character.
|
|
73
|
-
def name
|
|
74
|
-
meta? ? "::#{target}" : "##{target}"
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
#
|
|
78
|
-
def fullname
|
|
79
|
-
meta? ? "#{testcase}.#{target}" : "#{testcase}##{target}"
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
def to_s
|
|
84
|
-
if meta?
|
|
85
|
-
"#{testcase}.#{target}"
|
|
86
|
-
else
|
|
87
|
-
"#{testcase}##{target}"
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
#
|
|
92
|
-
def description
|
|
93
|
-
if meta?
|
|
94
|
-
#"#{testcase} .#{target} #{aspect}"
|
|
95
|
-
"#{testcase}.#{target} #{context} #{aspect}".strip
|
|
96
|
-
else
|
|
97
|
-
a = /^[aeiou]/i =~ testcase.to_s ? 'An' : 'A'
|
|
98
|
-
#"#{a} #{testcase} receiving ##{target} #{aspect}"
|
|
99
|
-
"#{testcase}##{target} #{context} #{aspect}".strip
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# START-COMMIT. 201105190006
|
|
104
|
-
|
|
105
|
-
# The file method returns the file name of +caller+ which
|
|
106
|
-
# was created upon initialization of this object. It is
|
|
107
|
-
# also the first element of #file_and_line.
|
|
108
|
-
#
|
|
109
|
-
# Returns file name of caller.
|
|
110
|
-
def file
|
|
111
|
-
file_and_line.first
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
# Returns line number of caller.
|
|
115
|
-
def line
|
|
116
|
-
file_and_line.last
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
# The file_and_line method returns the file name and line number of
|
|
120
|
-
# the caller created upon initialization of this object.
|
|
121
|
-
#
|
|
122
|
-
# This method is cached.
|
|
123
|
-
#
|
|
124
|
-
# Examples
|
|
125
|
-
# file_and_line #=> ['foo_test.rb', 123]
|
|
126
|
-
#
|
|
127
|
-
# Returns Array of file name and line number of caller.
|
|
128
|
-
def file_and_line
|
|
129
|
-
@file_and_line ||= (
|
|
130
|
-
line = caller[0]
|
|
131
|
-
i = line.rindex(':in')
|
|
132
|
-
line = i ? line[0...i] : line
|
|
133
|
-
f, l = File.basename(line).split(':')
|
|
134
|
-
[f, l]
|
|
135
|
-
)
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# END-COMMIT.
|
|
139
|
-
|
|
140
|
-
#
|
|
141
|
-
def match?(match)
|
|
142
|
-
match == target || match === aspect
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
end
|
|
147
|
-
|