aboutsummaryrefslogtreecommitdiff
path: root/protocol/v0v1/server/helpers_test.go
blob: ff2a69f33cb60c655a70be49d3c4d7b601b2d3dc (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 server_test

import (
	"bytes"
	"strings"
	"testing"

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

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
}