github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/deployment/transport/git/git_test.go (about)

     1  package git
     2  
     3  import (
     4  	"fmt"
     5  	"math/rand"
     6  	"testing"
     7  )
     8  
     9  type ExistsDependencyProvider struct {
    10  	cmd  string
    11  	find bool
    12  }
    13  
    14  var ExistsDependencyCases = []ExistsDependencyProvider{
    15  	{"git", true},
    16  	{fmt.Sprintf("not-found-%d", rand.Int()), false},
    17  }
    18  
    19  func TestExistsDependency(t *testing.T) {
    20  	for _, c := range ExistsDependencyCases {
    21  		exists := existsDependency(c.cmd)
    22  
    23  		if exists != c.find {
    24  			t.Errorf("existsDependency(%v) should return %v", c.cmd, c.find)
    25  		}
    26  	}
    27  }