summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go
blob: 6739c3f605e957e64566a49e6ec1db5cd7ee53a5 (plain)
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
package writer

type FakeGinkgoWriter struct {
	EventStream []string
}

func NewFake() *FakeGinkgoWriter {
	return &FakeGinkgoWriter{
		EventStream: []string{},
	}
}

func (writer *FakeGinkgoWriter) AddEvent(event string) {
	writer.EventStream = append(writer.EventStream, event)
}

func (writer *FakeGinkgoWriter) Truncate() {
	writer.EventStream = append(writer.EventStream, "TRUNCATE")
}

func (writer *FakeGinkgoWriter) DumpOut() {
	writer.EventStream = append(writer.EventStream, "DUMP")
}

func (writer *FakeGinkgoWriter) DumpOutWithHeader(header string) {
	writer.EventStream = append(writer.EventStream, "DUMP_WITH_HEADER: "+header)
}

func (writer *FakeGinkgoWriter) Bytes() []byte {
	writer.EventStream = append(writer.EventStream, "BYTES")
	return nil
}

func (writer *FakeGinkgoWriter) Write(data []byte) (n int, err error) {
	return 0, nil
}