github.com/anthonymayer/glide@v0.0.0-20160224162501-bff8b50d232e/repo/cache_test.go (about)

     1  package repo
     2  
     3  import "testing"
     4  
     5  func TestCacheCreateKey(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  	}
    10  
    11  	for k, v := range tests {
    12  		key, err := cacheCreateKey(k)
    13  		if err != nil {
    14  			t.Errorf("Cache key generation err: %s", err)
    15  			continue
    16  		}
    17  		if key != v {
    18  			t.Errorf("Expected cache key %s for %s but got %s", v, k, key)
    19  		}
    20  	}
    21  }