shithub: furgit

ref: 2a5c12f0152240f54d01653b70b7605103393afd
dir: /network/protocol/v0v1/server/helpers_test.go/

View raw version
package server_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
}