mirror of https://github.com/gogits/gogs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
808 B
41 lines
808 B
8 years ago
|
package reporting
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
type dot struct{ out *Printer }
|
||
|
|
||
|
func (self *dot) BeginStory(story *StoryReport) {}
|
||
|
|
||
|
func (self *dot) Enter(scope *ScopeReport) {}
|
||
|
|
||
|
func (self *dot) Report(report *AssertionResult) {
|
||
|
if report.Error != nil {
|
||
|
fmt.Print(redColor)
|
||
|
self.out.Insert(dotError)
|
||
|
} else if report.Failure != "" {
|
||
|
fmt.Print(yellowColor)
|
||
|
self.out.Insert(dotFailure)
|
||
|
} else if report.Skipped {
|
||
|
fmt.Print(yellowColor)
|
||
|
self.out.Insert(dotSkip)
|
||
|
} else {
|
||
|
fmt.Print(greenColor)
|
||
|
self.out.Insert(dotSuccess)
|
||
|
}
|
||
|
fmt.Print(resetColor)
|
||
|
}
|
||
|
|
||
|
func (self *dot) Exit() {}
|
||
|
|
||
|
func (self *dot) EndStory() {}
|
||
|
|
||
|
func (self *dot) Write(content []byte) (written int, err error) {
|
||
|
return len(content), nil // no-op
|
||
|
}
|
||
|
|
||
|
func NewDotReporter(out *Printer) *dot {
|
||
|
self := new(dot)
|
||
|
self.out = out
|
||
|
return self
|
||
|
}
|