aboutsummaryrefslogtreecommitdiff
path: root/network/protocol/v0v1/server/receivepack/helpers_test.go
blob: 5db8e6a6dd823bb101b7ac2e26846c8fe9aa9735 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package receivepack_test

import (
	"bytes"
	"strings"
	"testing"

	objectid "codeberg.org/lindenii/furgit/object/id"
)

type bufferWriteFlusher struct {
	bytes.Buffer
}

func (bufferWriteFlusher) Flush() error {
	return nil
}

func mustHexID(tb testing.TB, algo objectid.Algorithm, digit string) objectid.ObjectID {
	tb.Helper()

	id, err := objectid.ParseHex(algo, strings.Repeat(digit, algo.HexLen()))
	if err != nil {
		tb.Fatalf("objectid.ParseHex(%q): %v", strings.Repeat(digit, algo.HexLen()), err)
	}

	return id
}