8
9
10
11
12
13
14
15
16
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
49
50
51
52
53
54
55
|
# File 'lib/spork/run_strategy/local_process.rb', line 8
def run(argv, stderr, stdout)
$stdout, $stderr = stdout, stderr
Spork::Ext::TabCompletion.init
filter = argv
additional_options = nil
2.times {Readline::HISTORY.push argv.join(" ")}
while running?
test_framework.preload
begin
run_proc :each
test_framework.additional_options = additional_options if additional_options
test_framework.run_tests(filter, stderr, stdout)
run_proc :after_each
rescue Exception => e
puts "#{e.class}: #{e.message}"
puts e.backtrace
ensure
test_framework.reset
end
new_filter = Readline.readline("> '#{(filter + (additional_options || [])).join(" ")}' or: ").strip
exit 0 if new_filter.downcase == "exit"
unless new_filter.empty?
Readline::HISTORY.push new_filter
new_filter, *additional_options = new_filter.split(/\s+/)
additional_options = nil if additional_options.empty?
current_filter_without_lineno = filter_without_line_no filter[0]
if new_filter == "*"
filter = [current_filter_without_lineno]
elsif new_filter =~ /^:\d+$/
filter = [current_filter_without_lineno + new_filter]
elsif File.exist? filter_without_line_no new_filter
filter = [new_filter]
else
filter = [current_filter_without_lineno]
additional_options = [new_filter]
end
end
end
end
|