From 7e798fc34d703770e3391de8ecd65edea0d40181 Mon Sep 17 00:00:00 2001 From: Antonio Jesus Navarro Perez Date: Tue, 16 May 2017 16:08:20 +0200 Subject: transport/server: use Endpoint string representation as a map key. Two endpoints are not equals between them, even if they were generated using the same url or path. --- plumbing/transport/server/loader_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'plumbing/transport/server/loader_test.go') diff --git a/plumbing/transport/server/loader_test.go b/plumbing/transport/server/loader_test.go index 5f32cb0..38fabe3 100644 --- a/plumbing/transport/server/loader_test.go +++ b/plumbing/transport/server/loader_test.go @@ -5,6 +5,7 @@ import ( "path/filepath" "gopkg.in/src-d/go-git.v4/plumbing/transport" + "gopkg.in/src-d/go-git.v4/storage/memory" . "gopkg.in/check.v1" ) @@ -54,3 +55,18 @@ func (s *LoaderSuite) TestLoadIgnoreHost(c *C) { c.Assert(err, IsNil) c.Assert(sto, NotNil) } + +func (s *LoaderSuite) TestMapLoader(c *C) { + ep, err := transport.NewEndpoint("file://test") + sto := memory.NewStorage() + c.Assert(err, IsNil) + + loader := MapLoader{ep.String(): sto} + + ep, err = transport.NewEndpoint("file://test") + c.Assert(err, IsNil) + + loaderSto, err := loader.Load(ep) + c.Assert(err, IsNil) + c.Assert(sto, Equals, loaderSto) +} -- cgit