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
|
# File 'lib/sapphire/Testing/Executable.rb', line 14
def execute()
start = Time.now
Report do |x| x.TestStarted(self) end
begin
if(self.value.is_a? Pending)
result = ResultTree.new(self.text, TestResult.new("pending", self, "Pending", "", Time.now - start))
self.AddResult(result)
Report do |x| x.TestPending(result) end
return
end
self.block.call
result = ResultTree.new(self.text, TestResult.new("pass", self, "Success", "", Time.now - start))
self.AddResult(result)
Report do |x| x.TestPassed(result) end
rescue => msg
stack = msg.backtrace
message = msg.messages if (msg.is_a? ExpectationException)
message ||= msg.message
if(self.value.is_a? Broken)
result = ResultTree.new(self.text, TestResult.new("broken", self, message, stack, Time.now - start))
self.AddResult(result)
Report do |x| x.TestBroken(result) end
else
result = ResultTree.new(self.text, TestResult.new("fail", self, message, stack, Time.now - start))
self.AddResult(result)
Report do |x| x.TestFailed(result) end
end
end
end
|