You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: hash_test.go
    path of file: ./repos/go-git/plumbing/hash
    
    the code of the file until where you have to start completion: package hash

import (
	"crypto"
	"crypto/sha1"
	"crypto/sha512"
	"encoding/hex"
	"hash"
	"strings"
	"testing"
)

func TestRegisterHash(t *testing.T) {
	// Reset default hash to avoid side effects.
	defer reset()

	tests := []struct {
		name    string
		hash    crypto.Hash
		new     func() hash.Hash
		wantErr string
	}{
		{
			name: "sha1",
			hash: crypto.SHA1,
			ne
    
func TestRegisterHash(t *testing.T) {
	// Reset default hash to avoid side effects.
	defer reset()

	tests := []struct {
		name    string
		hash    crypto.Hash
		new     func() hash.Hash
		wantErr string
	}{
		{
			name: "sha1",
			hash: crypto.SHA1,
			new:  sha1.New,
		},
		{
			name:    "sha1",
			hash:    crypto.SHA1,
			wantErr: "cannot register hash: f is nil",
		},
		{
			name:    "sha512",
			hash:    crypto.SHA512,
			new:     sha512.New,
			wantErr: "unsupported hash function",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			err := RegisterHash(tt.hash, tt.new)
			if tt.wantErr == "" && err != nil {
				t.Errorf("unexpected error: %v", err)
			} else if tt.wantErr != "" && err == nil {
				t.Errorf("expected error: %v got: nil", tt.wantErr)
			} else if err != nil && !strings.Contains(err.Error(), tt.wantErr) {
				t.Errorf("expected error: %v got: %v", tt.wantErr, err)
			}
		})
	}
}