MCPcopy Index your code
hub / github.com/google/codesearch / testTrivialWrite

Function testTrivialWrite

index/write_test.go:139–157  ·  view source on GitHub ↗
(t *testing.T, doFlush bool)

Source from the content-addressed store, hash-verified

137}
138
139func testTrivialWrite(t *testing.T, doFlush bool) {
140 f, _ := ioutil.TempFile("", "index-test")
141 defer os.Remove(f.Name())
142 out := f.Name()
143 buildFlushIndex(out, nil, doFlush, trivialFiles)
144
145 data, err := ioutil.ReadFile(out)
146 if err != nil {
147 t.Fatalf("reading _test/index.triv: %v", err)
148 }
149 want := []byte(trivialIndex)
150 if !bytes.Equal(data, want) {
151 i := 0
152 for i < len(data) && i < len(want) && data[i] == want[i] {
153 i++
154 }
155 t.Fatalf("wrong index:\nhave: %q %q\nwant: %q %q", data[:i], data[i:], want[:i], want[i:])
156 }
157}
158
159func TestTrivialWrite(t *testing.T) {
160 testTrivialWrite(t, false)

Callers 2

TestTrivialWriteFunction · 0.85
TestTrivialWriteDiskFunction · 0.85

Calls 2

buildFlushIndexFunction · 0.85
NameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…