shithub: furgit

ref: df1f2fb3daa1acd25c88510f259d5535fb482126
dir: /network/protocol/sideband64k/append_helpers_test.go/

View raw version
package sideband64k_test

import (
	"testing"

	"codeberg.org/lindenii/furgit/network/protocol/sideband64k"
)

func TestAppendHelpers(t *testing.T) {
	t.Parallel()

	out, err := sideband64k.AppendData(nil, []byte("a"))
	if err != nil {
		t.Fatalf("AppendData: %v", err)
	}

	out, err = sideband64k.AppendProgress(out, []byte("b"))
	if err != nil {
		t.Fatalf("AppendProgress: %v", err)
	}

	out, err = sideband64k.AppendError(out, []byte("c"))
	if err != nil {
		t.Fatalf("AppendError: %v", err)
	}

	if got, want := string(out), "0006\x01a0006\x02b0006\x03c"; got != want {
		t.Fatalf("got %q, want %q", got, want)
	}
}