MCPcopy
hub / github.com/rclone/rclone / string

Method string

vfs/vfscache/writeback/writeback_test.go:30–51  ·  view source on GitHub ↗

string for debugging - make a copy and pop the items out in order

(t *testing.T)

Source from the content-addressed store, hash-verified

28
29// string for debugging - make a copy and pop the items out in order
30func (wb *WriteBack) string(t *testing.T) string {
31 wb.mu.Lock()
32 defer wb.mu.Unlock()
33 ws := wb.items
34
35 // check indexes OK first
36 for i := range ws {
37 assert.Equal(t, i, ws[i].index, ws[i].name)
38 }
39 wsCopy := make(writeBackItems, len(ws))
40 // deep copy the elements
41 for i := range wsCopy {
42 item := *ws[i]
43 wsCopy[i] = &item
44 }
45 // print them
46 var out []string
47 for wsCopy.Len() > 0 {
48 out = append(out, heap.Pop(&wsCopy).(*writeBackItem).name)
49 }
50 return strings.Join(out, ",")
51}
52
53func TestWriteBackItems(t *testing.T) {
54 // Test the items heap behaves properly

Callers 7

TestWriteBackItemsFunction · 0.95
TestWriteBackItemCRUDFunction · 0.45
TestWriteBackAddOKFunction · 0.45
TestWriteBackAddUpdateFunction · 0.45

Calls 6

JoinMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
EqualMethod · 0.45
LenMethod · 0.45
PopMethod · 0.45

Tested by

no test coverage detected