Files
mesh-controller/cmd/mesh-controller/same_commit_test.go
T

18 lines
597 B
Go

package main
import "testing"
// A held build's commit as recorded and as registered name one commit however each is abbreviated, a short name
// included (the fault the try of R4e's controller found: "c0" was never the same as "c0").
func TestACommitIsTheSameAsItselfHoweverShort(t *testing.T) {
for _, c := range []struct {
a, b string
same bool
}{{"c0", "c0", true}, {"c0ffee0123456789", "c0ffee0", true}, {"c0ffee0123", "c0ffee0999", false}, {"", "", false},
{"c0", "c1", false}} {
if got := sameCommitID(c.a, c.b); got != c.same {
t.Errorf("%q %q: %v", c.a, c.b, got)
}
}
}