mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 22:04:41 +00:00
45 lines
915 B
Go
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")
|
|
}
|
|
|
|
}
|