dot.go 808 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package reporting
  2. import "fmt"
  3. type dot struct{ out *Printer }
  4. func (self *dot) BeginStory(story *StoryReport) {}
  5. func (self *dot) Enter(scope *ScopeReport) {}
  6. func (self *dot) Report(report *AssertionResult) {
  7. if report.Error != nil {
  8. fmt.Print(redColor)
  9. self.out.Insert(dotError)
  10. } else if report.Failure != "" {
  11. fmt.Print(yellowColor)
  12. self.out.Insert(dotFailure)
  13. } else if report.Skipped {
  14. fmt.Print(yellowColor)
  15. self.out.Insert(dotSkip)
  16. } else {
  17. fmt.Print(greenColor)
  18. self.out.Insert(dotSuccess)
  19. }
  20. fmt.Print(resetColor)
  21. }
  22. func (self *dot) Exit() {}
  23. func (self *dot) EndStory() {}
  24. func (self *dot) Write(content []byte) (written int, err error) {
  25. return len(content), nil // no-op
  26. }
  27. func NewDotReporter(out *Printer) *dot {
  28. self := new(dot)
  29. self.out = out
  30. return self
  31. }