github.com/franciscocpg/glide@v0.0.0-20160823235512-96aa2921b647/cache/cache_test.go (about)

     1  package cache
     2  
     3  import "testing"
     4  
     5  func TestKey(t *testing.T) {
     6  	tests := map[string]string{
     7  		"https://github.com/foo/bar":     "https-github.com-foo-bar",
     8  		"git@github.com:foo/bar":         "git-github.com-foo-bar",
     9  		"https://github.com:123/foo/bar": "https-github.com-123-foo-bar",
    10  	}
    11  
    12  	for k, v := range tests {
    13  		key, err := Key(k)
    14  		if err != nil {
    15  			t.Errorf("Cache key generation err: %s", err)
    16  			continue
    17  		}
    18  		if key != v {
    19  			t.Errorf("Expected cache key %s for %s but got %s", v, k, key)
    20  		}
    21  	}
    22  }