Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Add test for subject with tab (re #123)
Browse files Browse the repository at this point in the history
  • Loading branch information
scorphus committed Jul 24, 2014
1 parent 9ab48fc commit b842899
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,3 +876,36 @@ func (s *S) TestGetBranchIntegrationEmptySubject(c *gocheck.C) {
c.Assert(branches[1]["authorEmail"], gocheck.Equals, "<much@email.com>")
c.Assert(branches[1]["subject"], gocheck.Equals, "")
}

func (s *S) TestGetBranchIntegrationSubjectWithTab(c *gocheck.C) {
oldBare := bare
bare = "/tmp"
repo := "gandalf-test-repo"
file := "README"
content := "will\tbark"
cleanUp, errCreate := CreateTestRepository(bare, repo, file, content)
defer func() {
cleanUp()
bare = oldBare
}()
c.Assert(errCreate, gocheck.IsNil)
errCreateBranches := CreateBranchesOnTestRepository(bare, repo, "doge_howls")
c.Assert(errCreateBranches, gocheck.IsNil)
branches, err := GetBranch(repo)
c.Assert(err, gocheck.IsNil)
c.Assert(len(branches), gocheck.Equals, 2)
c.Assert(branches[0]["ref"], gocheck.Matches, "[a-f0-9]{40}")
c.Assert(branches[0]["name"], gocheck.Equals, "doge_howls")
c.Assert(branches[0]["commiterName"], gocheck.Equals, "doge")
c.Assert(branches[0]["commiterEmail"], gocheck.Equals, "<much@email.com>")
c.Assert(branches[0]["authorName"], gocheck.Equals, "doge")
c.Assert(branches[0]["authorEmail"], gocheck.Equals, "<much@email.com>")
c.Assert(branches[0]["subject"], gocheck.Equals, "will\tbark")
c.Assert(branches[1]["ref"], gocheck.Matches, "[a-f0-9]{40}")
c.Assert(branches[1]["name"], gocheck.Equals, "master")
c.Assert(branches[1]["commiterName"], gocheck.Equals, "doge")
c.Assert(branches[1]["commiterEmail"], gocheck.Equals, "<much@email.com>")
c.Assert(branches[1]["authorName"], gocheck.Equals, "doge")
c.Assert(branches[1]["authorEmail"], gocheck.Equals, "<much@email.com>")
c.Assert(branches[1]["subject"], gocheck.Equals, "will\tbark")
}

0 comments on commit b842899

Please sign in to comment.