Skip to content

Commit

Permalink
config: add tests for branch desc marshaling and unmarshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
ninedraft committed Nov 7, 2021
1 parent b939cf8 commit e0567bd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (s *ConfigSuite) TestUnmarshal(c *C) {
[branch "master"]
remote = origin
merge = refs/heads/master
description = "Add support for branch description.\\n\\nEdit branch description: git branch --edit-description\\n"
[init]
defaultBranch = main
[url "ssh://git@github.com/"]
Expand Down Expand Up @@ -86,6 +87,7 @@ func (s *ConfigSuite) TestUnmarshal(c *C) {
c.Assert(cfg.Submodules["qux"].Branch, Equals, "bar")
c.Assert(cfg.Branches["master"].Remote, Equals, "origin")
c.Assert(cfg.Branches["master"].Merge, Equals, plumbing.ReferenceName("refs/heads/master"))
c.Assert(cfg.Branches["master"].Description, Equals, "Add support for branch description.\n\nEdit branch description: git branch --edit-description\n")
c.Assert(cfg.Init.DefaultBranch, Equals, "main")
}

Expand All @@ -111,6 +113,7 @@ func (s *ConfigSuite) TestMarshal(c *C) {
[branch "master"]
remote = origin
merge = refs/heads/master
description = "Add support for branch description.\\n\\nEdit branch description: git branch --edit-description\\n"
[url "ssh://git@github.com/"]
insteadOf = https://github.com/
[init]
Expand Down Expand Up @@ -149,9 +152,10 @@ func (s *ConfigSuite) TestMarshal(c *C) {
}

cfg.Branches["master"] = &Branch{
Name: "master",
Remote: "origin",
Merge: "refs/heads/master",
Name: "master",
Remote: "origin",
Merge: "refs/heads/master",
Description: "Add support for branch description.\n\nEdit branch description: git branch --edit-description\n",
}

cfg.URLs["ssh://git@github.com/"] = &URL{
Expand Down Expand Up @@ -364,4 +368,5 @@ func (s *ConfigSuite) TestRemoveUrlOptions(c *C) {
if strings.Contains(string(buf), "url") {
c.Fatal("conifg should not contain any url sections")
}
c.Assert(err, IsNil)
}

0 comments on commit e0567bd

Please sign in to comment.