forked from paketo-buildpacks/packit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger_test.go
74 lines (61 loc) · 1.72 KB
/
logger_test.go
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
66
67
68
69
70
71
72
73
74
package scribe_test
import (
"bytes"
"testing"
"github.com/paketo-buildpacks/packit/scribe"
"github.com/sclevine/spec"
. "github.com/onsi/gomega"
)
func testLogger(t *testing.T, context spec.G, it spec.S) {
var (
Expect = NewWithT(t).Expect
buffer *bytes.Buffer
logger scribe.Logger
)
it.Before(func() {
buffer = bytes.NewBuffer(nil)
logger = scribe.NewLogger(buffer)
})
context("Title", func() {
it("prints the output with no indentation", func() {
logger.Title("some-%s", "title")
Expect(buffer.String()).To(Equal("some-title\n"))
})
})
context("Process", func() {
it("prints the output with one level of indentation", func() {
logger.Process("some-%s", "process")
Expect(buffer.String()).To(Equal(" some-process\n"))
})
})
context("Subprocess", func() {
it("prints the output with two levels of indentation", func() {
logger.Subprocess("some-%s", "subprocess")
Expect(buffer.String()).To(Equal(" some-subprocess\n"))
})
})
context("Action", func() {
it("prints the output with three levels of indentation", func() {
logger.Action("some-%s", "action")
Expect(buffer.String()).To(Equal(" some-action\n"))
})
})
context("Detail", func() {
it("prints the output with four levels of indentation", func() {
logger.Detail("some-%s", "detail")
Expect(buffer.String()).To(Equal(" some-detail\n"))
})
})
context("Subdetail", func() {
it("prints the output with five levels of indentation", func() {
logger.Subdetail("some-%s", "subdetail")
Expect(buffer.String()).To(Equal(" some-subdetail\n"))
})
})
context("Break", func() {
it("prints an empty line", func() {
logger.Break()
Expect(buffer.String()).To(Equal("\n"))
})
})
}