Exemplo n.º 1
0
func TestPackDB(t *testing.T) {
	dir, err := ioutil.TempDir("", "TestPack")
	if err != nil {
		t.Fatalf("Unable to create temp directory: %v", err)
	}
	defer os.RemoveAll(dir)
	ctx := context.Background()
	path := filepath.Join(dir, "packdb")
	pack, err := indexpack.Create(ctx, path, indexpack.UnitType(testutil.UnitType))
	if err != nil {
		t.Fatalf("Unable to create index pack %q: %v", path, err)
	}
	t.Logf("Created index pack at %q", path)

	db := &DB{
		Archive:   pack,
		FormatKey: testutil.FormatKey,
		Convert:   kythe.ConvertUnit,
	}
	for _, err := range testutil.Run(ctx, db) {
		t.Error(err)
	}
}
Exemplo n.º 2
0
func TestMemDB(t *testing.T) {
	var db DB
	for _, err := range testutil.Run(context.Background(), &db) {
		t.Error(err)
	}
}