Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-17 12:50:49 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-20 17:13:09 +0300
commit73d240396463a12089485f076edfc63dd6439507 (patch)
tree123b8d407f377b55d76dae7d66e60b06d94daefb
parent6afafb4620863227175948c0f6266528c343d5e0 (diff)
gittest: Add function to write formatted pktlines
Add function to write formatted pktlines to a writer.
-rw-r--r--internal/git/gittest/pktline.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/git/gittest/pktline.go b/internal/git/gittest/pktline.go
index a75bb7b5f..e198f01e0 100644
--- a/internal/git/gittest/pktline.go
+++ b/internal/git/gittest/pktline.go
@@ -1,6 +1,7 @@
package gittest
import (
+ "fmt"
"io"
"testing"
@@ -14,6 +15,13 @@ func WritePktlineString(t *testing.T, writer io.Writer, data string) {
require.NoError(t, err)
}
+// WritePktlinef formats the given format string and writes the pktline-formatted data into the
+// writer.
+func WritePktlinef(t *testing.T, writer io.Writer, format string, args ...interface{}) {
+ _, err := pktline.WriteString(writer, fmt.Sprintf(format, args...))
+ require.NoError(t, err)
+}
+
// WritePktlineFlush writes the pktline-formatted flush into the writer.
func WritePktlineFlush(t *testing.T, writer io.Writer) {
require.NoError(t, pktline.WriteFlush(writer))