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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
# File 'lib/test_launcher/queries.rb', line 398
def command
return unless match
return unless test_cases.any?
if one_file?
{
notifies: ["Found #{pluralize(file_count, "file")}."],
command: runner.by_line_number(test_cases.first)
}
else
{
notifies: [
"Found #{pluralize(file_count, "file")}.",
"Cannot run all tests with --all because test frameworks don't accept multiple file/lines combos."
],
command: runner.by_line_number(most_recently_edited_test_case)
}
end
end
|
#match ⇒ Object
439
440
441
|
# File 'lib/test_launcher/queries.rb', line 439
def match
@match ||= request.search_string.match(LINE_SPLIT_REGEX)
end
|
#search_results ⇒ Object
429
430
431
432
433
434
435
436
437
|
# File 'lib/test_launcher/queries.rb', line 429
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
418
419
420
421
422
423
424
425
426
427
|
# File 'lib/test_launcher/queries.rb', line 418
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
|