lib/tork/driver.rb in tork-17.0.0 vs lib/tork/driver.rb in tork-17.0.1
- old
+ new
@@ -1,5 +1,6 @@
+require 'set'
require 'diff/lcs'
require 'tork/client'
require 'tork/server'
require 'tork/config'
@@ -28,28 +29,30 @@
def reabsorb_overhead_files
@master.quit if defined? @master
@master = Client::Transceiver.new('tork-master') do |message|
- event, file, tests = message
+ event, file, line_numbers = message
case event.to_sym
when :test
@waiting_test_files.delete file
- @running_test_files.push file
+ @running_test_files.add file
when :pass
@running_test_files.delete file
- @failed_test_files.delete file
- if tests.empty? and not @passed_test_files.include? file
- @passed_test_files.push file
+
+ # only whole test file runs qualify as pass
+ if line_numbers.empty?
+ @failed_test_files.delete file
+ @passed_test_files.add file
end
when :fail
@running_test_files.delete file
+ @failed_test_files.add file
@passed_test_files.delete file
- @failed_test_files.push file unless @failed_test_files.include? file
end
@client.send message
end
@@ -89,25 +92,24 @@
@master.quit
end
private
- @waiting_test_files = []
- @running_test_files = []
- @passed_test_files = []
- @failed_test_files = []
+ @waiting_test_files = Set.new
+ @running_test_files = Set.new
+ @passed_test_files = Set.new
+ @failed_test_files = Set.new
def rerun_running_test_files
run_test_files @running_test_files
end
def run_test_files files
files.each {|f| run_test_file f }
end
def run_test_file file
- if File.exist? file and not @waiting_test_files.include? file
- @waiting_test_files.push file
+ if File.exist? file and @waiting_test_files.add? file
@master.send [:test, file, find_changed_line_numbers(file)]
end
end
@lines_by_file = {}