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"
|
|
|
|
|
2020-04-17 02:02:37 +03:00
|
|
|
"github.com/github/hub/v2/github"
|
|
|
|
"github.com/github/hub/v2/internal/assert"
|
2013-04-28 21:45:00 +04:00
|
|
|
)
|
|
|
|
|
2014-10-20 00:12:54 +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)
|
|
|
|
}
|