aboutsummaryrefslogtreecommitdiffstats
path: root/config/config_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-22 03:29:05 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-22 03:29:05 +0200
commit2ed3474ab8e52c98a87e390d5128d45d693a115d (patch)
tree6f136c2508c22f6b5146ef08c49821a45a5f2357 /config/config_test.go
parent5b13c1a2e55cb442484d9c7b45389f422b110eec (diff)
downloadgo-git-2ed3474ab8e52c98a87e390d5128d45d693a115d.tar.gz
ForEach review and Commit.Tree err return
Diffstat (limited to 'config/config_test.go')
-rw-r--r--config/config_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/config/config_test.go b/config/config_test.go
new file mode 100644
index 0000000..853e518
--- /dev/null
+++ b/config/config_test.go
@@ -0,0 +1,31 @@
+package config
+
+import . "gopkg.in/check.v1"
+
+type ConfigSuite struct{}
+
+var _ = Suite(&ConfigSuite{})
+
+func (s *ConfigSuite) TestRemoteConfigValidateMissingURL(c *C) {
+ config := &RemoteConfig{Name: "foo"}
+ c.Assert(config.Validate(), Equals, ErrRemoteConfigEmptyURL)
+}
+
+func (s *ConfigSuite) TestRemoteConfigValidateInvalidURL(c *C) {
+ config := &RemoteConfig{Name: "foo", URL: "foo"}
+ c.Assert(config.Validate(), NotNil)
+}
+
+func (s *ConfigSuite) TestRemoteConfigValidateMissingName(c *C) {
+ config := &RemoteConfig{}
+ c.Assert(config.Validate(), Equals, ErrRemoteConfigEmptyName)
+}
+
+func (s *ConfigSuite) TestRemoteConfigValidateDefault(c *C) {
+ config := &RemoteConfig{Name: "foo", URL: "http://foo/bar"}
+ c.Assert(config.Validate(), IsNil)
+
+ fetch := config.Fetch
+ c.Assert(fetch, HasLen, 1)
+ c.Assert(fetch[0].String(), Equals, "+refs/heads/*:refs/remotes/foo/*")
+}