17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/distributest.rb', line 17
def self.start_loop
receive do |f|
f.when([:file, String]) do |text|
begin
pass_results, fail_results, profile, total_time_for_file, captured_std_err_out = Distributest::TestRunner.new.run_rspec_file(text)
rescue LoadError => e
f.send!([:load_error, e.to_s])
end
pass_results = pass_results.to_s
if (pass_results.nil? || pass_results.length == 0) && (fail_results.nil? || fail_results.length == 0)
f.send!([:pass_results, "."])
else
f.send!([:pass_results, pass_results]) unless pass_results.nil? or pass_results.length == 0
f.send!([:fail_results, fail_results]) unless fail_results.nil? or fail_results.length == 0
f.send!([:total_time_for_file, text, total_time_for_file])
f.send!([:profile, text, profile])
f.send!([:captured_std_err_out, captured_std_err_out]) unless captured_std_err_out == ""
end
f.send!(:ready_for_file)
f.receive_loop
end
f.when(:stop) { f.send!([:port_shutdown, "normal"]) }
f.when([:object, Any]) do |obj|
puts "in ruby in Any with obj #{obj.inspect}"
f.send!([:barf, "Barf in ruby with obj #{obj.inspect}"])
f.receive_loop
end
end
end
|