MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / TestFileReader_Read_SmallBuf

Function TestFileReader_Read_SmallBuf

internal/utils/bfs/file_reader_test.go:14–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestFileReader_Read_SmallBuf(t *testing.T) {
15 bFile, err := bfs.OpenBlocksFile("testdata/test.b", bfs.DefaultBlockFileOptions)
16 if err != nil {
17 t.Fatal(err)
18 }
19
20 reader, err := bFile.OpenFileReader(bfs.Hash("123456"), false)
21 if err != nil {
22 if os.IsNotExist(err) {
23 t.Log(err)
24 return
25 }
26 t.Fatal(err)
27 }
28
29 defer func() {
30 _ = reader.Close()
31 }()
32
33 var buf = make([]byte, 3)
34 for {
35 n, readErr := reader.Read(buf)
36 if n > 0 {
37 t.Log(string(buf[:n]))
38 }
39 if readErr != nil {
40 if readErr == io.EOF {
41 break
42 }
43 t.Fatal(readErr)
44 }
45 }
46}
47
48func TestFileReader_Read_LargeBuff(t *testing.T) {
49 bFile, err := bfs.OpenBlocksFile("testdata/test.b", bfs.DefaultBlockFileOptions)

Callers

nothing calls this directly

Calls 6

OpenBlocksFileFunction · 0.92
HashFunction · 0.92
LogMethod · 0.80
CloseMethod · 0.65
ReadMethod · 0.65
OpenFileReaderMethod · 0.45

Tested by

no test coverage detected