aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorChief <admin@117.sh>2019-08-30 14:08:56 -0400
committerChief <admin@117.sh>2019-08-30 14:08:56 -0400
commit4c43218e7b19b9db7d9ce6964a6cfc569cfddbf1 (patch)
treef73892663b8bf1a9a9eb5c49e29e940e31e08ed1 /internal
parent80d88d96cbbbef05054d53745b9488d864859fdd (diff)
downloadgo-git-4c43218e7b19b9db7d9ce6964a6cfc569cfddbf1.tar.gz
Use gocheck for test.
Signed-off-by: Chief <admin@117.sh>
Diffstat (limited to 'internal')
-rwxr-xr-x[-rw-r--r--]internal/url/url_test.go44
1 files changed, 27 insertions, 17 deletions
diff --git a/internal/url/url_test.go b/internal/url/url_test.go
index 710fa0c..d168db6 100644..100755
--- a/internal/url/url_test.go
+++ b/internal/url/url_test.go
@@ -2,9 +2,17 @@ package url
import (
"testing"
+
+ . "gopkg.in/check.v1"
)
-func TestMatchesScpLike(t *testing.T) {
+func Test(t *testing.T) { TestingT(t) }
+
+type URLSuite struct{}
+
+var _ = Suite(&URLSuite{})
+
+func (s *URLSuite) TestMatchesScpLike(c *C) {
examples := []string{
"git@github.com:james/bond",
"git@github.com:007/bond",
@@ -13,38 +21,40 @@ func TestMatchesScpLike(t *testing.T) {
}
for _, url := range examples {
- if !MatchesScpLike(url) {
- t.Fatalf("repo url %q did not match ScpLike", url)
- }
+ c.Check(MatchesScpLike(url), Equals, true)
}
}
-func TestFindScpLikeComponents(t *testing.T) {
+func (s *URLSuite) TestFindScpLikeComponents(c *C) {
url := "git@github.com:james/bond"
user, host, port, path := FindScpLikeComponents(url)
- if user != "git" || host != "github.com" || port != "" || path != "james/bond" {
- t.Fatalf("repo url %q did not match properly", user)
- }
+ c.Check(user, Equals, "git")
+ c.Check(host, Equals, "github.com")
+ c.Check(port, Equals, "")
+ c.Check(path, Equals, "james/bond")
url = "git@github.com:007/bond"
user, host, port, path = FindScpLikeComponents(url)
- if user != "git" || host != "github.com" || port != "" || path != "007/bond" {
- t.Fatalf("repo url %q did not match properly", user)
- }
+ c.Check(user, Equals, "git")
+ c.Check(host, Equals, "github.com")
+ c.Check(port, Equals, "")
+ c.Check(path, Equals, "007/bond")
url = "git@github.com:22:james/bond"
user, host, port, path = FindScpLikeComponents(url)
- if user != "git" || host != "github.com" || port != "22" || path != "james/bond" {
- t.Fatalf("repo url %q did not match properly", user)
- }
+ c.Check(user, Equals, "git")
+ c.Check(host, Equals, "github.com")
+ c.Check(port, Equals, "22")
+ c.Check(path, Equals, "james/bond")
url = "git@github.com:22:007/bond"
user, host, port, path = FindScpLikeComponents(url)
- if user != "git" || host != "github.com" || port != "22" || path != "007/bond" {
- t.Fatalf("repo url %q did not match properly", user)
- }
+ c.Check(user, Equals, "git")
+ c.Check(host, Equals, "github.com")
+ c.Check(port, Equals, "22")
+ c.Check(path, Equals, "007/bond")
}