1package reporting
2
3type gotestReporter struct{ test T }
4
5func (self *gotestReporter) BeginStory(story *StoryReport) {
6	self.test = story.Test
7}
8
9func (self *gotestReporter) Enter(scope *ScopeReport) {}
10
11func (self *gotestReporter) Report(r *AssertionResult) {
12	if !passed(r) {
13		self.test.Fail()
14	}
15}
16
17func (self *gotestReporter) Exit() {}
18
19func (self *gotestReporter) EndStory() {
20	self.test = nil
21}
22
23func (self *gotestReporter) Write(content []byte) (written int, err error) {
24	return len(content), nil // no-op
25}
26
27func NewGoTestReporter() *gotestReporter {
28	return new(gotestReporter)
29}
30
31func passed(r *AssertionResult) bool {
32	return r.Error == nil && r.Failure == ""
33}
34