MCPcopy
hub / github.com/smallstep/cli / TestSkipZeroReader

Function TestSkipZeroReader

utils/internal/utfbom/utfbom_test.go:165–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

163}
164
165func TestSkipZeroReader(t *testing.T) {
166 var z zeroReader
167
168 c := make(chan readerEncoding)
169 go func() {
170 r, enc := Skip(z)
171 c <- readerEncoding{r, enc}
172 }()
173
174 select {
175 case re := <-c:
176 if re.Enc != Unknown {
177 t.Error("Unknown encoding expected")
178 } else {
179 var b [1]byte
180 n, err := re.Rd.Read(b[:])
181 if n != 0 {
182 t.Error("unexpected bytes count:", n)
183 }
184 if !errors.Is(err, io.ErrNoProgress) {
185 t.Error("unexpected error:", err)
186 }
187 }
188 case <-time.After(time.Second):
189 t.Error("test timed out (endless loop in Skip?)")
190 }
191}
192
193func TestSkipOnlyZeroReader(t *testing.T) {
194 var z zeroReader

Callers

nothing calls this directly

Calls 3

SkipFunction · 0.85
ErrorMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…