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

Function TestLoggerLogsMultipleTasksInOrder

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

Source from the content-addressed store, hash-verified

60}
61
62func TestLoggerLogsMultipleTasksInOrder(t *testing.T) {
63 var buf bytes.Buffer
64
65 t1 := make(chan *Update)
66 go func() {
67 t1 <- &Update{"first", time.Now(), false}
68 t1 <- &Update{"second", time.Now(), false}
69 close(t1)
70 }()
71 t2 := make(chan *Update)
72 go func() {
73 t2 <- &Update{"third", time.Now(), false}
74 t2 <- &Update{"fourth", time.Now(), false}
75 close(t2)
76 }()
77
78 l := NewLogger(&buf, ForceProgress(true))
79 l.throttle = 0
80 l.widthFn = func() int { return 0 }
81 l.Enqueue(ChanTask(t1), ChanTask(t2))
82 l.Close()
83
84 assert.Equal(t, strings.Join([]string{
85 "first\r",
86 "second\r",
87 "second, done.\n",
88 "third\r",
89 "fourth\r",
90 "fourth, done.\n",
91 }, ""), buf.String())
92}
93
94func TestLoggerLogsMultipleTasksWithoutBlocking(t *testing.T) {
95 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