зеркало из https://github.com/mislav/hub.git
34 строки
875 B
Go
34 строки
875 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/github/hub/v2/github"
|
|
"github.com/github/hub/v2/internal/assert"
|
|
)
|
|
|
|
func TestPullRequest_ParsePullRequestProject(t *testing.T) {
|
|
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)
|
|
}
|