(t *testing.T, doFlush bool)
| 137 | } |
| 138 | |
| 139 | func 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 | |
| 159 | func TestTrivialWrite(t *testing.T) { |
| 160 | testTrivialWrite(t, false) |
no test coverage detected
searching dependent graphs…