Browse Source

Twiddle order of test table fields

pull/16/head
Kegan Dougal 8 years ago
parent
commit
c6483215f6
  1. 18
      src/github.com/matrix-org/go-neb/realms/jira/urls/urls_test.go

18
src/github.com/matrix-org/go-neb/realms/jira/urls/urls_test.go

@ -6,24 +6,24 @@ import (
var urltests = []struct { var urltests = []struct {
in string in string
outKey string
outBase string outBase string
outKey string
outRaw string outRaw string
}{ }{
// valid url key as input // valid url key as input
{"matrix.org/jira", "matrix.org/jira", "https://matrix.org/jira/", "matrix.org/jira"},
{"matrix.org/jira", "https://matrix.org/jira/", "matrix.org/jira", "matrix.org/jira"},
// valid url base as input // valid url base as input
{"https://matrix.org/jira/", "matrix.org/jira", "https://matrix.org/jira/", "https://matrix.org/jira/"},
{"https://matrix.org/jira/", "https://matrix.org/jira/", "matrix.org/jira", "https://matrix.org/jira/"},
// valid rest url as input // valid rest url as input
{"https://matrix.org/jira/rest/api/2/issue/12680", "matrix.org/jira", "https://matrix.org/jira/", "https://matrix.org/jira/rest/api/2/issue/12680"},
{"https://matrix.org/jira/rest/api/2/issue/12680", "https://matrix.org/jira/", "matrix.org/jira", "https://matrix.org/jira/rest/api/2/issue/12680"},
// missing trailing slash as input // missing trailing slash as input
{"https://matrix.org/jira", "matrix.org/jira", "https://matrix.org/jira/", "https://matrix.org/jira"},
{"https://matrix.org/jira", "https://matrix.org/jira/", "matrix.org/jira", "https://matrix.org/jira"},
// missing protocol but with trailing slash // missing protocol but with trailing slash
{"matrix.org/jira/", "matrix.org/jira", "https://matrix.org/jira/", "matrix.org/jira/"},
{"matrix.org/jira/", "https://matrix.org/jira/", "matrix.org/jira", "matrix.org/jira/"},
// no jira path as base url (subdomain) // no jira path as base url (subdomain)
{"https://jira.matrix.org", "jira.matrix.org", "https://jira.matrix.org/", "https://jira.matrix.org"},
{"https://jira.matrix.org", "https://jira.matrix.org/", "jira.matrix.org", "https://jira.matrix.org"},
// explicit http as input // explicit http as input
{"http://matrix.org/jira", "matrix.org/jira", "http://matrix.org/jira/", "http://matrix.org/jira"},
{"http://matrix.org/jira", "http://matrix.org/jira/", "matrix.org/jira", "http://matrix.org/jira"},
} }
func TestParseJIRAURL(t *testing.T) { func TestParseJIRAURL(t *testing.T) {
@ -36,7 +36,7 @@ func TestParseJIRAURL(t *testing.T) {
t.Fatalf("ParseJIRAURL(%s) => Key: Want %s got %s", urltest.in, urltest.outKey, jURL.Key) t.Fatalf("ParseJIRAURL(%s) => Key: Want %s got %s", urltest.in, urltest.outKey, jURL.Key)
} }
if jURL.Base != urltest.outBase { if jURL.Base != urltest.outBase {
t.Fatalf("ParseJIRAURL(%s) => Base: Want %s got %s", urltest.in, urltest.outBase, jURL.Key)
t.Fatalf("ParseJIRAURL(%s) => Base: Want %s got %s", urltest.in, urltest.outBase, jURL.Base)
} }
if jURL.Raw != urltest.outRaw { if jURL.Raw != urltest.outRaw {
t.Fatalf("ParseJIRAURL(%s) => Raw: Want %s got %s", urltest.in, urltest.outRaw, jURL.Raw) t.Fatalf("ParseJIRAURL(%s) => Raw: Want %s got %s", urltest.in, urltest.outRaw, jURL.Raw)

Loading…
Cancel
Save