File: branch_test.go

package info (click to toggle)
hub 2.14.2~ds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,376 kB
  • sloc: sh: 1,049; ruby: 857; makefile: 89
file content (40 lines) | stat: -rw-r--r-- 838 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package github

import (
	"testing"

	"github.com/bmizerany/assert"
)

func TestBranch_ShortName(t *testing.T) {
	lp, _ := LocalRepo()
	b := Branch{lp, "refs/heads/master"}
	assert.Equal(t, "master", b.ShortName())
}

func TestBranch_LongName(t *testing.T) {
	lp, _ := LocalRepo()

	b := Branch{lp, "refs/heads/master"}
	assert.Equal(t, "heads/master", b.LongName())

	b = Branch{lp, "refs/remotes/origin/master"}
	assert.Equal(t, "origin/master", b.LongName())
}

func TestBranch_RemoteName(t *testing.T) {
	lp, _ := LocalRepo()

	b := Branch{lp, "refs/remotes/origin/master"}
	assert.Equal(t, "origin", b.RemoteName())

	b = Branch{lp, "refs/head/master"}
	assert.Equal(t, "", b.RemoteName())
}

func TestBranch_IsRemote(t *testing.T) {
	lp, _ := LocalRepo()

	b := Branch{lp, "refs/remotes/origin/master"}
	assert.T(t, b.IsRemote())
}