Skip to content

Commit

Permalink
Merge pull request src-d#977 from filipnavara/config-test
Browse files Browse the repository at this point in the history
config: Add test for Windows local paths.
  • Loading branch information
mcuadros authored Oct 9, 2018
2 parents 37caf1f + c2ba07b commit 299f583
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
url = [email protected]:src-d/go-git.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*:refs/remotes/origin/pull/*
[remote "win-local"]
url = X:\\Git\\
[submodule "qux"]
path = qux
url = https://github.com/foo/qux.git
Expand All @@ -41,13 +43,15 @@ func (s *ConfigSuite) TestUnmarshall(c *C) {
c.Assert(cfg.Core.Worktree, Equals, "foo")
c.Assert(cfg.Core.CommentChar, Equals, "bar")
c.Assert(cfg.Pack.Window, Equals, uint(20))
c.Assert(cfg.Remotes, HasLen, 2)
c.Assert(cfg.Remotes, HasLen, 3)
c.Assert(cfg.Remotes["origin"].Name, Equals, "origin")
c.Assert(cfg.Remotes["origin"].URLs, DeepEquals, []string{"[email protected]:mcuadros/go-git.git"})
c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"})
c.Assert(cfg.Remotes["alt"].Name, Equals, "alt")
c.Assert(cfg.Remotes["alt"].URLs, DeepEquals, []string{"[email protected]:mcuadros/go-git.git", "[email protected]:src-d/go-git.git"})
c.Assert(cfg.Remotes["alt"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"})
c.Assert(cfg.Remotes["win-local"].Name, Equals, "win-local")
c.Assert(cfg.Remotes["win-local"].URLs, DeepEquals, []string{"X:\\Git\\"})
c.Assert(cfg.Submodules, HasLen, 1)
c.Assert(cfg.Submodules["qux"].Name, Equals, "qux")
c.Assert(cfg.Submodules["qux"].URL, Equals, "https://github.com/foo/qux.git")
Expand All @@ -69,6 +73,8 @@ func (s *ConfigSuite) TestMarshall(c *C) {
fetch = +refs/pull/*:refs/remotes/origin/pull/*
[remote "origin"]
url = [email protected]:mcuadros/go-git.git
[remote "win-local"]
url = "X:\\Git\\"
[submodule "qux"]
url = https://github.com/foo/qux.git
[branch "master"]
Expand All @@ -91,6 +97,11 @@ func (s *ConfigSuite) TestMarshall(c *C) {
Fetch: []RefSpec{"+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/remotes/origin/pull/*"},
}

cfg.Remotes["win-local"] = &RemoteConfig{
Name: "win-local",
URLs: []string{"X:\\Git\\"},
}

cfg.Submodules["qux"] = &Submodule{
Name: "qux",
URL: "https://github.com/foo/qux.git",
Expand Down Expand Up @@ -119,6 +130,8 @@ func (s *ConfigSuite) TestUnmarshallMarshall(c *C) {
url = [email protected]:mcuadros/go-git.git
fetch = +refs/heads/*:refs/remotes/origin/*
mirror = true
[remote "win-local"]
url = "X:\\Git\\"
[branch "master"]
remote = origin
merge = refs/heads/master
Expand Down

0 comments on commit 299f583

Please sign in to comment.