Files

24 lines
522 B
Go

package git
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestParseRemoteBranches(t *testing.T) {
t.Parallel()
input := []byte("aabbccdd\trefs/heads/main\r\n" +
"eeff0011\trefs/heads/develop\n" +
"22334455\trefs/heads/feature/foo\n" +
"deadbeef\trefs/tags/v1.0\n")
got := parseRemoteBranches(input)
require.Equal(t, []string{"main", "develop", "feature/foo"}, got)
}
func TestParseRemoteBranches_Empty(t *testing.T) {
t.Parallel()
got := parseRemoteBranches(nil)
require.Nil(t, got)
}