Class: TestLauncher::Queries::LineNumberQuery
Constant Summary
collapse
- LINE_SPLIT_REGEX =
/\A(?<file>.*):(?<line_number>\d+)\Z/
Instance Attribute Summary
Attributes inherited from BaseQuery
#request
Instance Method Summary
collapse
Methods inherited from BaseQuery
#initialize
Instance Method Details
#command ⇒ Object
354
355
356
357
358
359
360
361
362
363
364
365
366
|
# File 'lib/test_launcher/queries.rb', line 354
def command
return unless match
return unless test_cases.any?
if one_file?
shell.notify "Found #{pluralize(file_count, "file")}."
runner.by_line_number(test_cases.first)
else
shell.notify "Found #{pluralize(file_count, "file")}."
shell.notify "Cannot run all tests with --all because test frameworks don't accept multiple file/lines combos."
runner.by_line_number(most_recently_edited_test_case)
end
end
|
#match ⇒ Object
389
390
391
|
# File 'lib/test_launcher/queries.rb', line 389
def match
@match ||= request.search_string.match(LINE_SPLIT_REGEX)
end
|
#search_results ⇒ Object
379
380
381
382
383
384
385
386
387
|
# File 'lib/test_launcher/queries.rb', line 379
def search_results
@search_results ||= begin
if match
searcher.by_line(match[:file], match[:line_number].to_i)
else
[]
end
end
end
|
#test_cases ⇒ Object
368
369
370
371
372
373
374
375
376
377
|
# File 'lib/test_launcher/queries.rb', line 368
def test_cases
@test_cases ||= search_results.map {|sr|
request.test_case(
file: sr[:file],
line_number: sr[:line_number],
example: sr[:example_name],
request: request
)
}
end
|