fix(vcs): remove custom testing function

This commit is contained in:
jguer 2020-07-23 13:53:59 +02:00
parent b37a1f7ab4
commit 1177493895
No known key found for this signature in database
GPG key ID: 6D6CC9BEA8556B35

View file

@ -2,30 +2,10 @@ package main
import ( import (
"testing" "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) { func TestParsing(t *testing.T) {
type source struct { type source struct {
URL string URL string
@ -55,11 +35,8 @@ func TestParsing(t *testing.T) {
url, branch, protocols := parseSource(url) url, branch, protocols := parseSource(url)
compare := sources[n] compare := sources[n]
if url != compare.URL || assert.Equal(t, compare.URL, url)
branch != compare.Branch || assert.Equal(t, compare.Branch, branch)
!isEqual(protocols, compare.Protocols) { assert.Equal(t, compare.Protocols, 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)
}
} }
} }