MCPcopy
hub / github.com/git-lfs/git-lfs / TestLoggerLogsMultipleTasksWithoutBlocking

Function TestLoggerLogsMultipleTasksWithoutBlocking

tasklog/log_test.go:94–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestLoggerLogsMultipleTasksWithoutBlocking(t *testing.T) {
95 var buf bytes.Buffer
96
97 l := NewLogger(&buf, ForceProgress(true))
98 l.throttle = 0
99 t1, t2 := make(chan *Update), make(chan *Update)
100
101 l.widthFn = func() int { return 0 }
102 l.Enqueue(ChanTask(t1))
103
104 t1 <- &Update{"first", time.Now(), false}
105 l.Enqueue(ChanTask(t2))
106 close(t1)
107 t2 <- &Update{"second", time.Now(), false}
108 close(t2)
109
110 l.Close()
111
112 assert.Equal(t, strings.Join([]string{
113 "first\r",
114 "first, done.\n",
115 "second\r",
116 "second, done.\n",
117 }, ""), buf.String())
118}
119
120func TestLoggerThrottlesWrites(t *testing.T) {
121 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 7

EnqueueMethod · 0.95
CloseMethod · 0.95
NewLoggerFunction · 0.85
ForceProgressFunction · 0.85
ChanTaskTypeAlias · 0.85
StringMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected