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

command_test.go « git2go « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 14f1c0a3a6ef024fa15a6e795c3135ec6717410f (plain)
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 git2go

import (
	"bytes"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestSerialization_SerializeTo(t *testing.T) {
	type testStruct struct {
		Contents string `json:"contents"`
	}

	var buf bytes.Buffer

	input := testStruct{
		Contents: "foobar",
	}
	err := serializeTo(&buf, &input)
	require.NoError(t, err)
	require.NotZero(t, buf.Len())

	var output testStruct
	err = deserialize(buf.String(), &output)
	require.NoError(t, err)
	require.Equal(t, input, output)
}