mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-10 22:27:33 +01:00
Replace #34651 and address more problems including fix framework bugs and changing to QueryInfo and QueryContent calls. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package git
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/go-version"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
RunGitTests(m)
|
|
}
|
|
|
|
func TestParseGitVersion(t *testing.T) {
|
|
v, err := parseGitVersionLine("git version 2.29.3")
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, "2.29.3", v.String())
|
|
|
|
v, err = parseGitVersionLine("git version 2.29.3.windows.1")
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, "2.29.3", v.String())
|
|
|
|
_, err = parseGitVersionLine("git version")
|
|
assert.Error(t, err)
|
|
|
|
_, err = parseGitVersionLine("git version windows")
|
|
assert.Error(t, err)
|
|
}
|
|
|
|
func TestCheckGitVersionCompatibility(t *testing.T) {
|
|
assert.NoError(t, checkGitVersionCompatibility(version.Must(version.NewVersion("2.43.0"))))
|
|
assert.ErrorContains(t, checkGitVersionCompatibility(version.Must(version.NewVersion("2.43.1"))), "regression bug of GIT_FLUSH")
|
|
assert.NoError(t, checkGitVersionCompatibility(version.Must(version.NewVersion("2.43.2"))))
|
|
}
|