6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 22:04:41 +00:00
Files
git-get/new/status_test.go
Grzegorz Dlugoszewski 0b371341e7 Add branch status and tests
2020-05-27 20:30:04 +02:00

45 lines
915 B
Go

package new
import "testing"
func TestBranchStatusLocal(t *testing.T) {
tr := NewRepoWithCommit(t)
tr.NewBranch("branch")
repo, err := OpenRepo(tr.Path)
checkFatal(t, err)
err = repo.LoadStatus()
checkFatal(t, err)
if repo.Status.Branches["master"].Upstream != nil {
t.Errorf("'master' branch should not have an upstream")
}
if repo.Status.Branches["branch"].Upstream != nil {
t.Errorf("'branch' branch should not have an upstream")
}
}
func TestBranchStatusCloned(t *testing.T) {
origin := NewRepoWithCommit(t)
clone := origin.Clone()
clone.NewBranch("local")
repo, err := OpenRepo(clone.Path)
checkFatal(t, err)
err = repo.LoadStatus()
checkFatal(t, err)
if repo.Status.Branches["master"].Upstream == nil {
t.Errorf("'master' branch should have an upstream")
}
if repo.Status.Branches["local"].Upstream != nil {
t.Errorf("'local' branch should not have an upstream")
}
}