/usr/share/gocode/src/github.com/onsi/gomega/gexec/prefixed_writer_test.go is in golang-gomega-dev 1.0+git20160910.d59fa0a-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 | package gexec_test
import (
"bytes"
. "github.com/onsi/gomega/gexec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("PrefixedWriter", func() {
var buffer *bytes.Buffer
var writer *PrefixedWriter
BeforeEach(func() {
buffer = &bytes.Buffer{}
writer = NewPrefixedWriter("[p]", buffer)
})
It("should emit the prefix on newlines", func() {
writer.Write([]byte("abc"))
writer.Write([]byte("def\n"))
writer.Write([]byte("hij\n"))
writer.Write([]byte("\n\n"))
writer.Write([]byte("klm\n\nnop"))
writer.Write([]byte(""))
writer.Write([]byte("qrs"))
writer.Write([]byte("\ntuv\nwx"))
writer.Write([]byte("yz\n\n"))
Ω(buffer.String()).Should(Equal(`[p]abcdef
[p]hij
[p]
[p]
[p]klm
[p]
[p]nopqrs
[p]tuv
[p]wxyz
[p]
`))
})
})
|