From 09110d8e6d1ddb6f6a22867dcedeebd8f2262780 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 14 Feb 2017 15:56:32 +0100 Subject: config: added Config.Submodules --- config/config_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'config/config_test.go') diff --git a/config/config_test.go b/config/config_test.go index 313c96c..cfab36d 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -13,6 +13,10 @@ func (s *ConfigSuite) TestUnmarshall(c *C) { [remote "origin"] url = git@github.com:mcuadros/go-git.git fetch = +refs/heads/*:refs/remotes/origin/* +[submodule "qux"] + path = qux + url = https://github.com/foo/qux.git + branch = bar [branch "master"] remote = origin merge = refs/heads/master @@ -28,6 +32,11 @@ func (s *ConfigSuite) TestUnmarshall(c *C) { c.Assert(cfg.Remotes["origin"].Name, Equals, "origin") c.Assert(cfg.Remotes["origin"].URL, Equals, "git@github.com:mcuadros/go-git.git") c.Assert(cfg.Remotes["origin"].Fetch, DeepEquals, []RefSpec{"+refs/heads/*:refs/remotes/origin/*"}) + 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") + c.Assert(cfg.Submodules["qux"].Branch, Equals, "bar") + } func (s *ConfigSuite) TestMarshall(c *C) { @@ -36,6 +45,8 @@ func (s *ConfigSuite) TestMarshall(c *C) { worktree = bar [remote "origin"] url = git@github.com:mcuadros/go-git.git +[submodule "qux"] + url = https://github.com/foo/qux.git `) cfg := NewConfig() @@ -46,6 +57,11 @@ func (s *ConfigSuite) TestMarshall(c *C) { URL: "git@github.com:mcuadros/go-git.git", } + cfg.Submodules["qux"] = &Submodule{ + Name: "qux", + URL: "https://github.com/foo/qux.git", + } + b, err := cfg.Marshal() c.Assert(err, IsNil) -- cgit