hub/commands/pull_request_test.go

34 строки
875 B
Go
Исходник Постоянная ссылка Обычный вид История

2013-05-29 22:58:46 +04:00
package commands
2013-04-28 21:45:00 +04:00
import (
2014-07-16 02:44:48 +04:00
"testing"
"github.com/github/hub/v2/github"
"github.com/github/hub/v2/internal/assert"
2013-04-28 21:45:00 +04:00
)
func TestPullRequest_ParsePullRequestProject(t *testing.T) {
2013-12-08 12:33:48 +04:00
c := &github.Project{Host: "github.com", Owner: "jingweno", Name: "gh"}
s := "develop"
p, ref := parsePullRequestProject(c, s)
assert.Equal(t, "develop", ref)
assert.Equal(t, "github.com", p.Host)
assert.Equal(t, "jingweno", p.Owner)
assert.Equal(t, "gh", p.Name)
s = "mojombo:develop"
p, ref = parsePullRequestProject(c, s)
assert.Equal(t, "develop", ref)
assert.Equal(t, "github.com", p.Host)
assert.Equal(t, "mojombo", p.Owner)
assert.Equal(t, "gh", p.Name)
s = "mojombo/jekyll:develop"
p, ref = parsePullRequestProject(c, s)
assert.Equal(t, "develop", ref)
assert.Equal(t, "github.com", p.Host)
assert.Equal(t, "mojombo", p.Owner)
assert.Equal(t, "jekyll", p.Name)
}