/usr/share/gocode/src/github.com/smartystreets/goconvey/reporting/story.go is in golang-github-smartystreets-goconvey-dev 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 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 56 57 58 59 60 61 62 63 64 65 | // TODO: in order for this reporter to be completely honest
// we need to retrofit to be more like the json reporter such that:
// 1. it maintains ScopeResult collections, which count assertions
// 2. it reports only after EndStory(), so that all tick marks
// are placed near the appropriate title.
// 3. Under unit test
package reporting
import (
"fmt"
"github.com/smartystreets/goconvey/printing"
)
func (self *story) BeginStory(story *StoryReport) {}
func (self *story) Enter(scope *ScopeReport) {
self.out.Indent()
if _, found := self.titlesById[scope.ID]; !found {
self.out.Println("")
self.out.Print(scope.Title)
self.out.Insert(" ")
self.titlesById[scope.ID] = scope.Title
}
}
func (self *story) Report(report *AssertionResult) {
if report.Error != nil {
fmt.Print(redColor)
self.out.Insert(error_)
} else if report.Failure != "" {
fmt.Print(yellowColor)
self.out.Insert(failure)
} else if report.Skipped {
fmt.Print(yellowColor)
self.out.Insert(skip)
} else {
fmt.Print(greenColor)
self.out.Insert(success)
}
fmt.Print(resetColor)
}
func (self *story) Exit() {
self.out.Dedent()
}
func (self *story) EndStory() {
self.titlesById = make(map[string]string)
self.out.Println("\n")
}
func NewStoryReporter(out *printing.Printer) *story {
self := story{}
self.out = out
self.titlesById = make(map[string]string)
return &self
}
type story struct {
out *printing.Printer
titlesById map[string]string
}
|