github.com/echohead/hub@v2.2.1+incompatible/github/branch_test.go (about)

     1  package github
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/github/hub/Godeps/_workspace/src/github.com/bmizerany/assert"
     7  )
     8  
     9  func TestBranch_ShortName(t *testing.T) {
    10  	lp, _ := LocalRepo()
    11  	b := Branch{lp, "refs/heads/master"}
    12  	assert.Equal(t, "master", b.ShortName())
    13  }
    14  
    15  func TestBranch_LongName(t *testing.T) {
    16  	lp, _ := LocalRepo()
    17  
    18  	b := Branch{lp, "refs/heads/master"}
    19  	assert.Equal(t, "heads/master", b.LongName())
    20  
    21  	b = Branch{lp, "refs/remotes/origin/master"}
    22  	assert.Equal(t, "origin/master", b.LongName())
    23  }
    24  
    25  func TestBranch_RemoteName(t *testing.T) {
    26  	lp, _ := LocalRepo()
    27  
    28  	b := Branch{lp, "refs/remotes/origin/master"}
    29  	assert.Equal(t, "origin", b.RemoteName())
    30  
    31  	b = Branch{lp, "refs/head/master"}
    32  	assert.Equal(t, "", b.RemoteName())
    33  }
    34  
    35  func TestBranch_IsRemote(t *testing.T) {
    36  	lp, _ := LocalRepo()
    37  
    38  	b := Branch{lp, "refs/remotes/origin/master"}
    39  	assert.T(t, b.IsRemote())
    40  }