This file is indexed.

/usr/share/gocode/src/github.com/smartystreets/goconvey/convey/reporting/problems_test.go is in golang-github-smartystreets-goconvey-dev 1.6.1-2.

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
package reporting

import (
	"strings"
	"testing"
)

func TestNoopProblemReporterActions(t *testing.T) {
	file, reporter := setup()
	reporter.BeginStory(nil)
	reporter.Enter(nil)
	reporter.Exit()
	expected := ""
	actual := file.String()
	if expected != actual {
		t.Errorf("Expected: '(blank)'\nActual:  '%s'", actual)
	}
}

func TestReporterPrintsFailuresAndErrorsAtTheEndOfTheStory(t *testing.T) {
	file, reporter := setup()
	reporter.Report(NewFailureReport("failed"))
	reporter.Report(NewErrorReport("error"))
	reporter.Report(NewSuccessReport())
	reporter.EndStory()

	result := file.String()
	if !strings.Contains(result, "Errors:\n") {
		t.Errorf("Expected errors, found none.")
	}
	if !strings.Contains(result, "Failures:\n") {
		t.Errorf("Expected failures, found none.")
	}

	// Each stack trace looks like: `* /path/to/file.go`, so look for `* `.
	// With go 1.4+ there is a line in some stack traces that looks like this:
	//   `testing.(*M).Run(0x2082d60a0, 0x25b7c0)`
	// So we can't just look for "*" anymore.
	problemCount := strings.Count(result, "* ")
	if problemCount != 2 {
		t.Errorf("Expected one failure and one error (total of 2 '*' characters). Got %d", problemCount)
	}
}

func setup() (file *memoryFile, reporter *problem) {
	monochrome()
	file = newMemoryFile()
	printer := NewPrinter(file)
	reporter = NewProblemReporter(printer)
	return
}