aboutsummaryrefslogtreecommitdiffstats
path: root/config/config_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-14 15:56:32 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-02-14 15:56:32 +0100
commit09110d8e6d1ddb6f6a22867dcedeebd8f2262780 (patch)
treec7d50987ec6f134faa6adb70a3f7e328992f0fc3 /config/config_test.go
parent7e990a811d9e23b5a3573c405b70f06a1be9e7b6 (diff)
downloadgo-git-09110d8e6d1ddb6f6a22867dcedeebd8f2262780.tar.gz
config: added Config.Submodules
Diffstat (limited to 'config/config_test.go')
-rw-r--r--config/config_test.go16
1 files changed, 16 insertions, 0 deletions
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)