mirror of
https://github.com/Jguer/yay
synced 2024-08-31 13:49:28 +00:00
fix(vcs): remove custom testing function
This commit is contained in:
parent
b37a1f7ab4
commit
1177493895
33
vcs_test.go
33
vcs_test.go
|
@ -2,30 +2,10 @@ package main
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func isEqual(a, b []string) bool {
|
||||
if a == nil && b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if a == nil || b == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
for i := range a {
|
||||
if a[i] != b[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func TestParsing(t *testing.T) {
|
||||
type source struct {
|
||||
URL string
|
||||
|
@ -55,11 +35,8 @@ func TestParsing(t *testing.T) {
|
|||
url, branch, protocols := parseSource(url)
|
||||
compare := sources[n]
|
||||
|
||||
if url != compare.URL ||
|
||||
branch != compare.Branch ||
|
||||
!isEqual(protocols, compare.Protocols) {
|
||||
t.Fatalf("Test %d failed: Expected: url=%+v branch=%+v protocols=%+v\ngot url=%+v branch=%+v protocols=%+v",
|
||||
n+1, compare.URL, compare.Branch, compare.Protocols, url, branch, protocols)
|
||||
}
|
||||
assert.Equal(t, compare.URL, url)
|
||||
assert.Equal(t, compare.Branch, branch)
|
||||
assert.Equal(t, compare.Protocols, protocols)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue