Browse Source

Use assert in legacy unit tests (#867)

Ethan Koenig 2 years ago
parent
commit
d2329e1c26
69 changed files with 237 additions and 6971 deletions
  1. 11 19
      models/models_test.go
  2. 30 59
      models/repo_test.go
  3. 22 35
      models/ssh_key_test.go
  4. 5 9
      modules/avatar/avatar_test.go
  5. 169 281
      modules/markdown/markdown_test.go
  6. 0 12
      vendor/github.com/smartystreets/assertions/CONTRIBUTING.md
  7. 0 23
      vendor/github.com/smartystreets/assertions/LICENSE.md
  8. 0 575
      vendor/github.com/smartystreets/assertions/README.md
  9. 0 3
      vendor/github.com/smartystreets/assertions/assertions.goconvey
  10. 0 244
      vendor/github.com/smartystreets/assertions/collections.go
  11. 0 105
      vendor/github.com/smartystreets/assertions/doc.go
  12. 0 280
      vendor/github.com/smartystreets/assertions/equality.go
  13. 0 23
      vendor/github.com/smartystreets/assertions/filter.go
  14. 0 27
      vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE
  15. 0 477
      vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go
  16. 0 202
      vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE
  17. 0 58
      vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md
  18. 0 70
      vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of.go
  19. 0 32
      vendor/github.com/smartystreets/assertions/internal/oglematchers/any.go
  20. 0 94
      vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go
  21. 0 61
      vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go
  22. 0 88
      vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go
  23. 0 91
      vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are.go
  24. 0 541
      vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go
  25. 0 51
      vendor/github.com/smartystreets/assertions/internal/oglematchers/error.go
  26. 0 39
      vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go
  27. 0 39
      vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go
  28. 0 37
      vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as.go
  29. 0 46
      vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr.go
  30. 0 134
      vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to.go
  31. 0 41
      vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go
  32. 0 152
      vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go
  33. 0 86
      vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go
  34. 0 69
      vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp.go
  35. 0 43
      vendor/github.com/smartystreets/assertions/internal/oglematchers/new_matcher.go
  36. 0 53
      vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go
  37. 0 74
      vendor/github.com/smartystreets/assertions/internal/oglematchers/panics.go
  38. 0 65
      vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee.go
  39. 0 36
      vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go
  40. 0 93
      vendor/github.com/smartystreets/assertions/messages.go
  41. 0 115
      vendor/github.com/smartystreets/assertions/panic.go
  42. 0 141
      vendor/github.com/smartystreets/assertions/quantity.go
  43. 0 69
      vendor/github.com/smartystreets/assertions/serializer.go
  44. 0 227
      vendor/github.com/smartystreets/assertions/strings.go
  45. 0 202
      vendor/github.com/smartystreets/assertions/time.go
  46. 0 112
      vendor/github.com/smartystreets/assertions/type.go
  47. 0 23
      vendor/github.com/smartystreets/goconvey/LICENSE.md
  48. 0 68
      vendor/github.com/smartystreets/goconvey/convey/assertions.go
  49. 0 272
      vendor/github.com/smartystreets/goconvey/convey/context.go
  50. 0 4
      vendor/github.com/smartystreets/goconvey/convey/convey.goconvey
  51. 0 103
      vendor/github.com/smartystreets/goconvey/convey/discovery.go
  52. 0 218
      vendor/github.com/smartystreets/goconvey/convey/doc.go
  53. 0 28
      vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go
  54. 0 81
      vendor/github.com/smartystreets/goconvey/convey/init.go
  55. 0 15
      vendor/github.com/smartystreets/goconvey/convey/nilReporter.go
  56. 0 16
      vendor/github.com/smartystreets/goconvey/convey/reporting/console.go
  57. 0 5
      vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go
  58. 0 40
      vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go
  59. 0 33
      vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go
  60. 0 94
      vendor/github.com/smartystreets/goconvey/convey/reporting/init.go
  61. 0 88
      vendor/github.com/smartystreets/goconvey/convey/reporting/json.go
  62. 0 57
      vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go
  63. 0 80
      vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go
  64. 0 39
      vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go
  65. 0 2
      vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey
  66. 0 179
      vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go
  67. 0 108
      vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go
  68. 0 73
      vendor/github.com/smartystreets/goconvey/convey/reporting/story.go
  69. 0 12
      vendor/vendor.json

+ 11 - 19
models/models_test.go

@@ -7,27 +7,19 @@ package models
7 7
 import (
8 8
 	"testing"
9 9
 
10
-	. "github.com/smartystreets/goconvey/convey"
10
+	"github.com/stretchr/testify/assert"
11 11
 )
12 12
 
13 13
 func Test_parsePostgreSQLHostPort(t *testing.T) {
14
-	testSuites := []struct {
15
-		input      string
16
-		host, port string
17
-	}{
18
-		{"127.0.0.1:1234", "127.0.0.1", "1234"},
19
-		{"127.0.0.1", "127.0.0.1", "5432"},
20
-		{"[::1]:1234", "[::1]", "1234"},
21
-		{"[::1]", "[::1]", "5432"},
22
-		{"/tmp/pg.sock:1234", "/tmp/pg.sock", "1234"},
23
-		{"/tmp/pg.sock", "/tmp/pg.sock", "5432"},
14
+	test := func (input, expectedHost, expectedPort string) {
15
+		host, port := parsePostgreSQLHostPort(input)
16
+		assert.Equal(t, expectedHost, host)
17
+		assert.Equal(t, expectedPort, port)
24 18
 	}
25
-
26
-	Convey("Parse PostgreSQL host and port", t, func() {
27
-		for _, suite := range testSuites {
28
-			host, port := parsePostgreSQLHostPort(suite.input)
29
-			So(host, ShouldEqual, suite.host)
30
-			So(port, ShouldEqual, suite.port)
31
-		}
32
-	})
19
+	test("127.0.0.1:1234", "127.0.0.1", "1234")
20
+	test("127.0.0.1", "127.0.0.1", "5432")
21
+	test("[::1]:1234", "[::1]", "1234")
22
+	test("[::1]", "[::1]", "5432")
23
+	test("/tmp/pg.sock:1234", "/tmp/pg.sock", "1234")
24
+	test("/tmp/pg.sock", "/tmp/pg.sock", "5432")
33 25
 }

+ 30 - 59
models/repo_test.go

@@ -9,69 +9,40 @@ import (
9 9
 
10 10
 	"code.gitea.io/gitea/modules/markdown"
11 11
 
12
-	. "github.com/smartystreets/goconvey/convey"
13 12
 	"github.com/stretchr/testify/assert"
14 13
 )
15 14
 
16 15
 func TestRepo(t *testing.T) {
17
-	Convey("The metas map", t, func() {
18
-		var repo = new(Repository)
19
-		repo.Name = "testrepo"
20
-		repo.Owner = new(User)
21
-		repo.Owner.Name = "testuser"
22
-		externalTracker := RepoUnit{
23
-			Type: UnitTypeExternalTracker,
24
-			Config: &ExternalTrackerConfig{
25
-				ExternalTrackerFormat: "https://someurl.com/{user}/{repo}/{issue}",
26
-			},
27
-		}
28
-		repo.Units = []*RepoUnit{
29
-			&externalTracker,
30
-		}
31
-
32
-		Convey("When no external tracker is configured", func() {
33
-			Convey("It should be nil", func() {
34
-				repo.Units = nil
35
-				So(repo.ComposeMetas(), ShouldEqual, map[string]string(nil))
36
-			})
37
-			Convey("It should be nil even if other settings are present", func() {
38
-				repo.Units = nil
39
-				So(repo.ComposeMetas(), ShouldEqual, map[string]string(nil))
40
-			})
41
-		})
42
-
43
-		Convey("When an external issue tracker is configured", func() {
44
-			repo.Units = []*RepoUnit{
45
-				&externalTracker,
46
-			}
47
-			Convey("It should default to numeric issue style", func() {
48
-				metas := repo.ComposeMetas()
49
-				So(metas["style"], ShouldEqual, markdown.IssueNameStyleNumeric)
50
-			})
51
-			Convey("It should pass through numeric issue style setting", func() {
52
-				externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markdown.IssueNameStyleNumeric
53
-				metas := repo.ComposeMetas()
54
-				So(metas["style"], ShouldEqual, markdown.IssueNameStyleNumeric)
55
-			})
56
-			Convey("It should pass through alphanumeric issue style setting", func() {
57
-				externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markdown.IssueNameStyleAlphanumeric
58
-				metas := repo.ComposeMetas()
59
-				So(metas["style"], ShouldEqual, markdown.IssueNameStyleAlphanumeric)
60
-			})
61
-			Convey("It should contain the user name", func() {
62
-				metas := repo.ComposeMetas()
63
-				So(metas["user"], ShouldEqual, "testuser")
64
-			})
65
-			Convey("It should contain the repo name", func() {
66
-				metas := repo.ComposeMetas()
67
-				So(metas["repo"], ShouldEqual, "testrepo")
68
-			})
69
-			Convey("It should contain the URL format", func() {
70
-				metas := repo.ComposeMetas()
71
-				So(metas["format"], ShouldEqual, "https://someurl.com/{user}/{repo}/{issue}")
72
-			})
73
-		})
74
-	})
16
+	repo := &Repository{Name: "testRepo"}
17
+	repo.Owner = &User{Name: "testOwner"}
18
+
19
+	repo.Units = nil
20
+	assert.Nil(t, repo.ComposeMetas())
21
+
22
+	externalTracker := RepoUnit{
23
+		Type: UnitTypeExternalTracker,
24
+		Config: &ExternalTrackerConfig{
25
+			ExternalTrackerFormat: "https://someurl.com/{user}/{repo}/{issue}",
26
+		},
27
+	}
28
+
29
+	testSuccess := func(expectedStyle string) {
30
+		repo.Units = []*RepoUnit{&externalTracker}
31
+		repo.ExternalMetas = nil
32
+		metas := repo.ComposeMetas()
33
+		assert.Equal(t, expectedStyle, metas["style"])
34
+		assert.Equal(t, "testRepo", metas["repo"])
35
+		assert.Equal(t, "testOwner", metas["user"])
36
+		assert.Equal(t, "https://someurl.com/{user}/{repo}/{issue}", metas["format"])
37
+	}
38
+
39
+	testSuccess(markdown.IssueNameStyleNumeric)
40
+
41
+	externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markdown.IssueNameStyleAlphanumeric
42
+	testSuccess(markdown.IssueNameStyleAlphanumeric)
43
+
44
+	externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markdown.IssueNameStyleNumeric
45
+	testSuccess(markdown.IssueNameStyleNumeric)
75 46
 }
76 47
 
77 48
 func TestGetRepositoryCount(t *testing.T) {

File diff suppressed because it is too large
+ 22 - 35
models/ssh_key_test.go


+ 5 - 9
modules/avatar/avatar_test.go

@@ -7,17 +7,13 @@ package avatar
7 7
 import (
8 8
 	"testing"
9 9
 
10
-	. "github.com/smartystreets/goconvey/convey"
10
+	"github.com/stretchr/testify/assert"
11 11
 )
12 12
 
13 13
 func Test_RandomImage(t *testing.T) {
14
-	Convey("Generate a random avatar from email", t, func() {
15
-		_, err := RandomImage([]byte("gogs@local"))
16
-		So(err, ShouldBeNil)
14
+	_, err := RandomImage([]byte("gogs@local"))
15
+	assert.NoError(t, err)
17 16
 
18
-		Convey("Try to generate an image with size zero", func() {
19
-			_, err := RandomImageSize(0, []byte("gogs@local"))
20
-			So(err, ShouldNotBeNil)
21
-		})
22
-	})
17
+	_, err = RandomImageSize(0, []byte("gogs@local"))
18
+	assert.Error(t, err)
23 19
 }

+ 169 - 281
modules/markdown/markdown_test.go

@@ -2,307 +2,195 @@ package markdown_test
2 2
 
3 3
 import (
4 4
 	"bytes"
5
+	"fmt"
6
+	"net/url"
7
+	"path"
8
+	"strconv"
5 9
 	"testing"
6 10
 
7 11
 	. "code.gitea.io/gitea/modules/markdown"
8 12
 	"code.gitea.io/gitea/modules/setting"
13
+
9 14
 	"github.com/russross/blackfriday"
10
-	. "github.com/smartystreets/goconvey/convey"
15
+	"github.com/stretchr/testify/assert"
11 16
 )
12 17
 
13
-func TestMarkdown(t *testing.T) {
14
-	Convey("Rendering an issue mention", t, func() {
15
-		var (
16
-			urlPrefix                   = "/prefix"
17
-			metas     map[string]string = nil
18
-		)
19
-		setting.AppSubURLDepth = 0
20
-
21
-		Convey("To the internal issue tracker", func() {
22
-			Convey("It should not render anything when there are no mentions", func() {
23
-				testCases := []string{
24
-					"",
25
-					"this is a test",
26
-					"test 123 123 1234",
27
-					"#",
28
-					"# # #",
29
-					"# 123",
30
-					"#abcd",
31
-					"##1234",
32
-					"test#1234",
33
-					"#1234test",
34
-					" test #1234test",
35
-				}
36
-
37
-				for i := 0; i < len(testCases); i++ {
38
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i])
39
-				}
40
-			})
41
-			Convey("It should render freestanding mentions", func() {
42
-				testCases := []string{
43
-					"#1234 test", "<a href=\"/prefix/issues/1234\">#1234</a> test",
44
-					"test #1234 issue", "test <a href=\"/prefix/issues/1234\">#1234</a> issue",
45
-					"test issue #1234", "test issue <a href=\"/prefix/issues/1234\">#1234</a>",
46
-					"#5 test", "<a href=\"/prefix/issues/5\">#5</a> test",
47
-					"test #5 issue", "test <a href=\"/prefix/issues/5\">#5</a> issue",
48
-					"test issue #5", "test issue <a href=\"/prefix/issues/5\">#5</a>",
49
-				}
18
+const urlPrefix = "/prefix"
50 19
 
51
-				for i := 0; i < len(testCases); i += 2 {
52
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
53
-				}
54
-			})
55
-			Convey("It should not render issue mention without leading space", func() {
56
-				input := []byte("test#54321 issue")
57
-				expected := "test#54321 issue"
58
-				So(string(RenderIssueIndexPattern(input, urlPrefix, metas)), ShouldEqual, expected)
59
-			})
60
-			Convey("It should not render issue mention without trailing space", func() {
61
-				input := []byte("test #54321issue")
62
-				expected := "test #54321issue"
63
-				So(string(RenderIssueIndexPattern(input, urlPrefix, metas)), ShouldEqual, expected)
64
-			})
65
-			Convey("It should render issue mention in parentheses", func() {
66
-				testCases := []string{
67
-					"(#54321 issue)", "(<a href=\"/prefix/issues/54321\">#54321</a> issue)",
68
-					"test (#54321) issue", "test (<a href=\"/prefix/issues/54321\">#54321</a>) issue",
69
-					"test (#54321 extra) issue", "test (<a href=\"/prefix/issues/54321\">#54321</a> extra) issue",
70
-					"test (#54321 issue)", "test (<a href=\"/prefix/issues/54321\">#54321</a> issue)",
71
-					"test (#54321)", "test (<a href=\"/prefix/issues/54321\">#54321</a>)",
72
-				}
73
-
74
-				for i := 0; i < len(testCases); i += 2 {
75
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
76
-				}
77
-			})
78
-			Convey("It should render multiple issue mentions in the same line", func() {
79
-				testCases := []string{
80
-					"#54321 #1243", "<a href=\"/prefix/issues/54321\">#54321</a> <a href=\"/prefix/issues/1243\">#1243</a>",
81
-					"test #54321 #1243", "test <a href=\"/prefix/issues/54321\">#54321</a> <a href=\"/prefix/issues/1243\">#1243</a>",
82
-					"(#54321 #1243)", "(<a href=\"/prefix/issues/54321\">#54321</a> <a href=\"/prefix/issues/1243\">#1243</a>)",
83
-					"(#54321)(#1243)", "(<a href=\"/prefix/issues/54321\">#54321</a>)(<a href=\"/prefix/issues/1243\">#1243</a>)",
84
-					"text #54321 test #1243 issue", "text <a href=\"/prefix/issues/54321\">#54321</a> test <a href=\"/prefix/issues/1243\">#1243</a> issue",
85
-					"#1 (#4321) test", "<a href=\"/prefix/issues/1\">#1</a> (<a href=\"/prefix/issues/4321\">#4321</a>) test",
86
-				}
87
-
88
-				for i := 0; i < len(testCases); i += 2 {
89
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
90
-				}
91
-			})
92
-		})
93
-		Convey("To an external issue tracker with numeric style", func() {
94
-			metas = make(map[string]string)
95
-			metas["format"] = "https://someurl.com/{user}/{repo}/{index}"
96
-			metas["user"] = "someuser"
97
-			metas["repo"] = "somerepo"
98
-			metas["style"] = IssueNameStyleNumeric
20
+var numericMetas = map[string]string{
21
+	"format": "https://someurl.com/{user}/{repo}/{index}",
22
+	"user":   "someUser",
23
+	"repo":   "someRepo",
24
+	"style":  IssueNameStyleNumeric,
25
+}
99 26
 
100
-			Convey("should not render anything when there are no mentions", func() {
101
-				testCases := []string{
102
-					"this is a test",
103
-					"test 123 123 1234",
104
-					"#",
105
-					"# # #",
106
-					"# 123",
107
-					"#abcd",
108
-				}
27
+var alphanumericMetas = map[string]string{
28
+	"format": "https://someurl.com/{user}/{repo}/{index}",
29
+	"user":   "someUser",
30
+	"repo":   "someRepo",
31
+	"style":  IssueNameStyleAlphanumeric,
32
+}
109 33
 
110
-				for i := 0; i < len(testCases); i++ {
111
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i])
112
-				}
113
-			})
114
-			Convey("It should render freestanding issue mentions", func() {
115
-				testCases := []string{
116
-					"#1234 test", "<a href=\"https://someurl.com/someuser/somerepo/1234\">#1234</a> test",
117
-					"test #1234 issue", "test <a href=\"https://someurl.com/someuser/somerepo/1234\">#1234</a> issue",
118
-					"test issue #1234", "test issue <a href=\"https://someurl.com/someuser/somerepo/1234\">#1234</a>",
119
-					"#5 test", "<a href=\"https://someurl.com/someuser/somerepo/5\">#5</a> test",
120
-					"test #5 issue", "test <a href=\"https://someurl.com/someuser/somerepo/5\">#5</a> issue",
121
-					"test issue #5", "test issue <a href=\"https://someurl.com/someuser/somerepo/5\">#5</a>",
122
-				}
123
-				for i := 0; i < len(testCases); i += 2 {
124
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
125
-				}
126
-			})
127
-			Convey("It should not render issue mention without leading space", func() {
128
-				input := []byte("test#54321 issue")
129
-				expected := "test#54321 issue"
130
-				So(string(RenderIssueIndexPattern(input, urlPrefix, metas)), ShouldEqual, expected)
131
-			})
132
-			Convey("It should not render issue mention without trailing space", func() {
133
-				input := []byte("test #54321issue")
134
-				expected := "test #54321issue"
135
-				So(string(RenderIssueIndexPattern(input, urlPrefix, metas)), ShouldEqual, expected)
136
-			})
137
-			Convey("It should render issue mention in parentheses", func() {
138
-				testCases := []string{
139
-					"(#54321 issue)", "(<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> issue)",
140
-					"test (#54321) issue", "test (<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a>) issue",
141
-					"test (#54321 extra) issue", "test (<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> extra) issue",
142
-					"test (#54321 issue)", "test (<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> issue)",
143
-					"test (#54321)", "test (<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a>)",
144
-				}
34
+// numericLink an HTML to a numeric-style issue
35
+func numericIssueLink(baseURL string, index int) string {
36
+	u, _ := url.Parse(baseURL)
37
+	u.Path = path.Join(u.Path, strconv.Itoa(index))
38
+	return link(u.String(), fmt.Sprintf("#%d", index))
39
+}
145 40
 
146
-				for i := 0; i < len(testCases); i += 2 {
147
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
148
-				}
149
-			})
150
-			Convey("It should render multiple issue mentions in the same line", func() {
151
-				testCases := []string{
152
-					"#54321 #1243", "<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> <a href=\"https://someurl.com/someuser/somerepo/1243\">#1243</a>",
153
-					"test #54321 #1243", "test <a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> <a href=\"https://someurl.com/someuser/somerepo/1243\">#1243</a>",
154
-					"(#54321 #1243)", "(<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> <a href=\"https://someurl.com/someuser/somerepo/1243\">#1243</a>)",
155
-					"(#54321)(#1243)", "(<a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a>)(<a href=\"https://someurl.com/someuser/somerepo/1243\">#1243</a>)",
156
-					"text #54321 test #1243 issue", "text <a href=\"https://someurl.com/someuser/somerepo/54321\">#54321</a> test <a href=\"https://someurl.com/someuser/somerepo/1243\">#1243</a> issue",
157
-					"#1 (#4321) test", "<a href=\"https://someurl.com/someuser/somerepo/1\">#1</a> (<a href=\"https://someurl.com/someuser/somerepo/4321\">#4321</a>) test",
158
-				}
41
+// alphanumLink an HTML link to an alphanumeric-style issue
42
+func alphanumIssueLink(baseURL string, name string) string {
43
+	u, _ := url.Parse(baseURL)
44
+	u.Path = path.Join(u.Path, name)
45
+	return link(u.String(), name)
46
+}
159 47
 
160
-				for i := 0; i < len(testCases); i += 2 {
161
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
162
-				}
163
-			})
164
-		})
165
-		Convey("To an external issue tracker with alphanumeric style", func() {
166
-			metas = make(map[string]string)
167
-			metas["format"] = "https://someurl.com/{user}/{repo}/?b={index}"
168
-			metas["user"] = "someuser"
169
-			metas["repo"] = "somerepo"
170
-			metas["style"] = IssueNameStyleAlphanumeric
171
-			Convey("It should not render anything when there are no mentions", func() {
172
-				testCases := []string{
173
-					"",
174
-					"this is a test",
175
-					"test 123 123 1234",
176
-					"#",
177
-					"##1234",
178
-					"# 123",
179
-					"#abcd",
180
-					"test #123",
181
-					"abc-1234",         // issue prefix must be capital
182
-					"ABc-1234",         // issue prefix must be _all_ capital
183
-					"ABCDEFGHIJK-1234", // the limit is 10 characters in the prefix
184
-					"ABC1234",          // dash is required
185
-					"test ABC- test",   // number is required
186
-					"test -1234 test",  // prefix is required
187
-					"testABC-123 test", // leading space is required
188
-					"test ABC-123test", // trailing space is required
189
-					"ABC-0123",         // no leading zero
190
-				}
48
+// urlContentsLink an HTML link whose contents is the target URL
49
+func urlContentsLink(href string) string {
50
+	return link(href, href)
51
+}
191 52
 
192
-				for i := 0; i < len(testCases); i += 2 {
193
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i])
194
-				}
195
-			})
196
-			Convey("It should render freestanding issue mention", func() {
197
-				testCases := []string{
198
-					"OTT-1234 test", "<a href=\"https://someurl.com/someuser/somerepo/?b=OTT-1234\">OTT-1234</a> test",
199
-					"test T-12 issue", "test <a href=\"https://someurl.com/someuser/somerepo/?b=T-12\">T-12</a> issue",
200
-					"test issue ABCDEFGHIJ-1234567890", "test issue <a href=\"https://someurl.com/someuser/somerepo/?b=ABCDEFGHIJ-1234567890\">ABCDEFGHIJ-1234567890</a>",
201
-					"A-1 test", "<a href=\"https://someurl.com/someuser/somerepo/?b=A-1\">A-1</a> test",
202
-					"test ZED-1 issue", "test <a href=\"https://someurl.com/someuser/somerepo/?b=ZED-1\">ZED-1</a> issue",
203
-					"test issue DEED-7154", "test issue <a href=\"https://someurl.com/someuser/somerepo/?b=DEED-7154\">DEED-7154</a>",
204
-				}
205
-				for i := 0; i < len(testCases); i += 2 {
206
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
207
-				}
208
-			})
209
-			Convey("It should render issue mention in parentheses", func() {
210
-				testCases := []string{
211
-					"(ABG-124 issue)", "(<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> issue)",
212
-					"test (ABG-124) issue", "test (<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a>) issue",
213
-					"test (ABG-124 extra) issue", "test (<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> extra) issue",
214
-					"test (ABG-124 issue)", "test (<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> issue)",
215
-					"test (ABG-124)", "test (<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a>)",
216
-				}
53
+// link an HTML link
54
+func link(href, contents string) string {
55
+	return fmt.Sprintf("<a href=\"%s\">%s</a>", href, contents)
56
+}
217 57
 
218
-				for i := 0; i < len(testCases); i += 2 {
219
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
220
-				}
221
-			})
222
-			Convey("It should render multiple issue mentions in the same line", func() {
223
-				testCases := []string{
224
-					"ABG-124 OTT-4321", "<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> <a href=\"https://someurl.com/someuser/somerepo/?b=OTT-4321\">OTT-4321</a>",
225
-					"test ABG-124 OTT-4321", "test <a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> <a href=\"https://someurl.com/someuser/somerepo/?b=OTT-4321\">OTT-4321</a>",
226
-					"(ABG-124 OTT-4321)", "(<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> <a href=\"https://someurl.com/someuser/somerepo/?b=OTT-4321\">OTT-4321</a>)",
227
-					"(ABG-124)(OTT-4321)", "(<a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a>)(<a href=\"https://someurl.com/someuser/somerepo/?b=OTT-4321\">OTT-4321</a>)",
228
-					"text ABG-124 test OTT-4321 issue", "text <a href=\"https://someurl.com/someuser/somerepo/?b=ABG-124\">ABG-124</a> test <a href=\"https://someurl.com/someuser/somerepo/?b=OTT-4321\">OTT-4321</a> issue",
229
-					"A-1 (RRE-345) test", "<a href=\"https://someurl.com/someuser/somerepo/?b=A-1\">A-1</a> (<a href=\"https://someurl.com/someuser/somerepo/?b=RRE-345\">RRE-345</a>) test",
230
-				}
58
+func testRenderIssueIndexPattern(t *testing.T, input, expected string, metas map[string]string) {
59
+	assert.Equal(t, expected,
60
+		string(RenderIssueIndexPattern([]byte(input), urlPrefix, metas)))
61
+}
231 62
 
232
-				for i := 0; i < len(testCases); i += 2 {
233
-					So(string(RenderIssueIndexPattern([]byte(testCases[i]), urlPrefix, metas)), ShouldEqual, testCases[i+1])
234
-				}
235
-			})
236
-		})
237
-	})
63
+func TestRenderIssueIndexPattern(t *testing.T) {
64
+	// numeric: render inputs without valid mentions
65
+	test := func(s string) {
66
+		testRenderIssueIndexPattern(t, s, s, nil)
67
+		testRenderIssueIndexPattern(t, s, s, numericMetas)
68
+	}
69
+
70
+	// should not render anything when there are no mentions
71
+	test("")
72
+	test("this is a test")
73
+	test("test 123 123 1234")
74
+	test("#")
75
+	test("# # #")
76
+	test("# 123")
77
+	test("#abcd")
78
+	test("##1234")
79
+	test("test#1234")
80
+	test("#1234test")
81
+	test(" test #1234test")
82
+
83
+	// should not render issue mention without leading space
84
+	test("test#54321 issue")
85
+
86
+	// should not render issue mention without trailing space
87
+	test("test #54321issue")
88
+}
238 89
 
239
-	Convey("Rendering an issue URL", t, func() {
240
-		setting.AppURL = "http://localhost:3000/"
241
-		htmlFlags := 0
242
-		htmlFlags |= blackfriday.HTML_SKIP_STYLE
243
-		htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
244
-		renderer := &Renderer{
245
-			Renderer: blackfriday.HtmlRenderer(htmlFlags, "", ""),
90
+func TestRenderIssueIndexPattern2(t *testing.T) {
91
+	// numeric: render inputs with valid mentions
92
+	test := func(s, expectedFmt string, indices ...int) {
93
+		links := make([]interface{}, len(indices))
94
+		for i, index := range indices {
95
+			links[i] = numericIssueLink(path.Join(urlPrefix, "issues"), index)
246 96
 		}
247
-		buffer := new(bytes.Buffer)
248
-		Convey("To the internal issue tracker", func() {
249
-			Convey("It should render valid issue URLs", func() {
250
-				testCases := []string{
251
-					"http://localhost:3000/user/repo/issues/3333", "<a href=\"http://localhost:3000/user/repo/issues/3333\">#3333</a>",
252
-				}
253
-
254
-				for i := 0; i < len(testCases); i += 2 {
255
-					renderer.AutoLink(buffer, []byte(testCases[i]), blackfriday.LINK_TYPE_NORMAL)
97
+		expectedNil := fmt.Sprintf(expectedFmt, links...)
98
+		testRenderIssueIndexPattern(t, s, expectedNil, nil)
256 99
 
257
-					line, _ := buffer.ReadString(0)
258
-					So(line, ShouldEqual, testCases[i+1])
259
-				}
260
-			})
261
-			Convey("It should render but not change non-issue URLs", func() {
262
-				testCases := []string{
263
-					"http://1111/2222/ssss-issues/3333?param=blah&blahh=333", "<a href=\"http://1111/2222/ssss-issues/3333?param=blah&amp;blahh=333\">http://1111/2222/ssss-issues/3333?param=blah&amp;blahh=333</a>",
264
-					"http://test.com/issues/33333", "<a href=\"http://test.com/issues/33333\">http://test.com/issues/33333</a>",
265
-					"http://test.com/issues/3", "<a href=\"http://test.com/issues/3\">http://test.com/issues/3</a>",
266
-					"http://issues/333", "<a href=\"http://issues/333\">http://issues/333</a>",
267
-					"https://issues/333", "<a href=\"https://issues/333\">https://issues/333</a>",
268
-					"http://tissues/0", "<a href=\"http://tissues/0\">http://tissues/0</a>",
269
-				}
270
-
271
-				for i := 0; i < len(testCases); i += 2 {
272
-					renderer.AutoLink(buffer, []byte(testCases[i]), blackfriday.LINK_TYPE_NORMAL)
100
+		for i, index := range indices {
101
+			links[i] = numericIssueLink("https://someurl.com/someUser/someRepo/", index)
102
+		}
103
+		expectedNum := fmt.Sprintf(expectedFmt, links...)
104
+		testRenderIssueIndexPattern(t, s, expectedNum, numericMetas)
105
+	}
106
+
107
+	// should render freestanding mentions
108
+	test("#1234 test", "%s test", 1234)
109
+	test("test #8 issue", "test %s issue", 8)
110
+	test("test issue #1234", "test issue %s", 1234)
111
+
112
+	// should render mentions in parentheses
113
+	test("(#54321 issue)", "(%s issue)", 54321)
114
+	test("test (#9801 extra) issue", "test (%s extra) issue", 9801)
115
+	test("test (#1)", "test (%s)", 1)
116
+
117
+	// should render multiple issue mentions in the same line
118
+	test("#54321 #1243", "%s %s", 54321, 1243)
119
+	test("wow (#54321 #1243)", "wow (%s %s)", 54321, 1243)
120
+	test("(#4)(#5)", "(%s)(%s)", 4, 5)
121
+	test("#1 (#4321) test", "%s (%s) test", 1, 4321)
122
+}
273 123
 
274
-					line, _ := buffer.ReadString(0)
275
-					So(line, ShouldEqual, testCases[i+1])
276
-				}
277
-			})
278
-		})
279
-	})
124
+func TestRenderIssueIndexPattern3(t *testing.T) {
125
+	// alphanumeric: render inputs without valid mentions
126
+	test := func(s string) {
127
+		testRenderIssueIndexPattern(t, s, s, alphanumericMetas)
128
+	}
129
+	test("")
130
+	test("this is a test")
131
+	test("test 123 123 1234")
132
+	test("#")
133
+	test("##1234")
134
+	test("# 123")
135
+	test("#abcd")
136
+	test("test #123")
137
+	test("abc-1234")         // issue prefix must be capital
138
+	test("ABc-1234")         // issue prefix must be _all_ capital
139
+	test("ABCDEFGHIJK-1234") // the limit is 10 characters in the prefix
140
+	test("ABC1234")          // dash is required
141
+	test("test ABC- test")   // number is required
142
+	test("test -1234 test")  // prefix is required
143
+	test("testABC-123 test") // leading space is required
144
+	test("test ABC-123test") // trailing space is required
145
+	test("ABC-0123")         // no leading zero
146
+}
280 147
 
281
-	Convey("Rendering a commit URL", t, func() {
282
-		setting.AppURL = "http://localhost:3000/"
283
-		htmlFlags := 0
284
-		htmlFlags |= blackfriday.HTML_SKIP_STYLE
285
-		htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
286
-		renderer := &Renderer{
287
-			Renderer: blackfriday.HtmlRenderer(htmlFlags, "", ""),
148
+func TestRenderIssueIndexPattern4(t *testing.T) {
149
+	// alphanumeric: render inputs with valid mentions
150
+	test := func(s, expectedFmt string, names ...string) {
151
+		links := make([]interface{}, len(names))
152
+		for i, name := range names {
153
+			links[i] = alphanumIssueLink("https://someurl.com/someUser/someRepo/", name)
288 154
 		}
289
-		buffer := new(bytes.Buffer)
290
-		Convey("To the internal issue tracker", func() {
291
-			Convey("It should correctly convert URLs", func() {
292
-				testCases := []string{
293
-					"http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae", " <code><a href=\"http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae\">d8a994ef24</a></code>",
294
-					"http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2", " <code><a href=\"http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2\">d8a994ef24</a></code>",
295
-					"https://external-link.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2", "<a href=\"https://external-link.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2\">https://external-link.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2</a>",
296
-					"https://commit/d8a994ef243349f321568f9e36d5c3f444b99cae", "<a href=\"https://commit/d8a994ef243349f321568f9e36d5c3f444b99cae\">https://commit/d8a994ef243349f321568f9e36d5c3f444b99cae</a>",
297
-				}
298
-
299
-				for i := 0; i < len(testCases); i += 2 {
300
-					renderer.AutoLink(buffer, []byte(testCases[i]), blackfriday.LINK_TYPE_NORMAL)
155
+		expected := fmt.Sprintf(expectedFmt, links...)
156
+		testRenderIssueIndexPattern(t, s, expected, alphanumericMetas)
157
+	}
158
+	test("OTT-1234 test", "%s test", "OTT-1234")
159
+	test("test T-12 issue", "test %s issue", "T-12")
160
+	test("test issue ABCDEFGHIJ-1234567890", "test issue %s", "ABCDEFGHIJ-1234567890")
161
+}
301 162
 
302
-					line, _ := buffer.ReadString(0)
303
-					So(line, ShouldEqual, testCases[i+1])
304
-				}
305
-			})
306
-		})
307
-	})
163
+func TestRenderer_AutoLink(t *testing.T) {
164
+	setting.AppURL = "http://localhost:3000/"
165
+	htmlFlags := blackfriday.HTML_SKIP_STYLE | blackfriday.HTML_OMIT_CONTENTS
166
+	renderer := &Renderer{
167
+		Renderer: blackfriday.HtmlRenderer(htmlFlags, "", ""),
168
+	}
169
+	test := func(input, expected string) {
170
+		buffer := new(bytes.Buffer)
171
+		renderer.AutoLink(buffer, []byte(input), blackfriday.LINK_TYPE_NORMAL)
172
+		assert.Equal(t, expected, buffer.String())
173
+	}
174
+
175
+	// render valid issue URLs
176
+	test("http://localhost:3000/user/repo/issues/3333",
177
+		numericIssueLink("http://localhost:3000/user/repo/issues/", 3333))
178
+
179
+	// render, but not change, invalid issue URLs
180
+	test("http://1111/2222/ssss-issues/3333?param=blah&blahh=333",
181
+		urlContentsLink("http://1111/2222/ssss-issues/3333?param=blah&amp;blahh=333"))
182
+	test("http://test.com/issues/33333", urlContentsLink("http://test.com/issues/33333"))
183
+	test("https://issues/333", urlContentsLink("https://issues/333"))
184
+
185
+	// render valid commit URLs
186
+	test("http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae",
187
+		" <code><a href=\"http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae\">d8a994ef24</a></code>")
188
+	test("http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2",
189
+		" <code><a href=\"http://localhost:3000/user/project/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2\">d8a994ef24</a></code>")
190
+
191
+	// render other commit URLs
192
+	test("https://external-link.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2",
193
+		urlContentsLink("https://external-link.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2"))
194
+	test("https://commit/d8a994ef243349f321568f9e36d5c3f444b99cae",
195
+		urlContentsLink("https://commit/d8a994ef243349f321568f9e36d5c3f444b99cae"))
308 196
 }

+ 0 - 12
vendor/github.com/smartystreets/assertions/CONTRIBUTING.md

@@ -1,12 +0,0 @@
1
-# Contributing
2
-
3
-In general, the code posted to the [SmartyStreets github organization](https://github.com/smartystreets) is created to solve specific problems at SmartyStreets that are ancillary to our core products in the address verification industry and may or may not be useful to other organizations or developers. Our reason for posting said code isn't necessarily to solicit feedback or contributions from the community but more as a showcase of some of the approaches to solving problems we have adopted.
4
-
5
-Having stated that, we do consider issues raised by other githubbers as well as contributions submitted via pull requests. When submitting such a pull request, please follow these guidelines:
6
-
7
-- _Look before you leap:_ If the changes you plan to make are significant, it's in everyone's best interest for you to discuss them with a SmartyStreets team member prior to opening a pull request.
8
-- _License and ownership:_ If modifying the `LICENSE.md` file, limit your changes to fixing typographical mistakes. Do NOT modify the actual terms in the license or the copyright by **SmartyStreets, LLC**. Code submitted to SmartyStreets projects becomes property of SmartyStreets and must be compatible with the associated license.
9
-- _Testing:_ If the code you are submitting resides in packages/modules covered by automated tests, be sure to add passing tests that cover your changes and assert expected behavior and state. Submit the additional test cases as part of your change set.
10
-- _Style:_ Match your approach to **naming** and **formatting** with the surrounding code. Basically, the code you submit shouldn't stand out.
11
-  - "Naming" refers to such constructs as variables, methods, functions, classes, structs, interfaces, packages, modules, directories, files, etc...
12
-  - "Formatting" refers to such constructs as whitespace, horizontal line length, vertical function length, vertical file length, indentation, curly braces, etc...

+ 0 - 23
vendor/github.com/smartystreets/assertions/LICENSE.md

@@ -1,23 +0,0 @@
1
-Copyright (c) 2016 SmartyStreets, LLC
2
-
3
-Permission is hereby granted, free of charge, to any person obtaining a copy 
4
-of this software and associated documentation files (the "Software"), to deal 
5
-in the Software without restriction, including without limitation the rights 
6
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
7
-copies of the Software, and to permit persons to whom the Software is 
8
-furnished to do so, subject to the following conditions:
9
-
10
-The above copyright notice and this permission notice shall be included in all 
11
-copies or substantial portions of the Software.
12
-
13
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
14
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
15
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
16
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
17
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
18
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
19
-SOFTWARE.
20
-
21
-NOTE: Various optional and subordinate components carry their own licensing
22
-requirements and restrictions.  Use of those components is subject to the terms
23
-and conditions outlined the respective license of each component.

+ 0 - 575
vendor/github.com/smartystreets/assertions/README.md

@@ -1,575 +0,0 @@
1
-# assertions
2
---
3
-    import "github.com/smartystreets/assertions"
4
-
5
-Package assertions contains the implementations for all assertions which are
6
-referenced in goconvey's `convey` package
7
-(github.com/smartystreets/goconvey/convey) and gunit
8
-(github.com/smartystreets/gunit) for use with the So(...) method. They can also
9
-be used in traditional Go test functions and even in applications.
10
-
11
-Many of the assertions lean heavily on work done by Aaron Jacobs in his
12
-excellent oglematchers library. (https://github.com/jacobsa/oglematchers) The
13
-ShouldResemble assertion leans heavily on work done by Daniel Jacques in his
14
-very helpful go-render library. (https://github.com/luci/go-render)
15
-
16
-## Usage
17
-
18
-#### func  GoConveyMode
19
-
20
-```go
21
-func GoConveyMode(yes bool)
22
-```
23
-GoConveyMode provides control over JSON serialization of failures. When using
24
-the assertions in this package from the convey package JSON results are very
25
-helpful and can be rendered in a DIFF view. In that case, this function will be
26
-called with a true value to enable the JSON serialization. By default, the
27
-assertions in this package will not serializer a JSON result, making standalone
28
-ussage more convenient.
29
-
30
-#### func  ShouldAlmostEqual
31
-
32
-```go
33
-func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string
34
-```
35
-ShouldAlmostEqual makes sure that two parameters are close enough to being
36
-equal. The acceptable delta may be specified with a third argument, or a very
37
-small default delta will be used.
38
-
39
-#### func  ShouldBeBetween
40
-
41
-```go
42
-func ShouldBeBetween(actual interface{}, expected ...interface{}) string
43
-```
44
-ShouldBeBetween receives exactly three parameters: an actual value, a lower
45
-bound, and an upper bound. It ensures that the actual value is between both
46
-bounds (but not equal to either of them).
47
-
48
-#### func  ShouldBeBetweenOrEqual
49
-
50
-```go
51
-func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
52
-```
53
-ShouldBeBetweenOrEqual receives exactly three parameters: an actual value, a
54
-lower bound, and an upper bound. It ensures that the actual value is between
55
-both bounds or equal to one of them.
56
-
57
-#### func  ShouldBeBlank
58
-
59
-```go
60
-func ShouldBeBlank(actual interface{}, expected ...interface{}) string
61
-```
62
-ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal
63
-to "".
64
-
65
-#### func  ShouldBeChronological
66
-
67
-```go
68
-func ShouldBeChronological(actual interface{}, expected ...interface{}) string
69
-```
70
-ShouldBeChronological receives a []time.Time slice and asserts that the are in
71
-chronological order starting with the first time.Time as the earliest.
72
-
73
-#### func  ShouldBeEmpty
74
-
75
-```go
76
-func ShouldBeEmpty(actual interface{}, expected ...interface{}) string
77
-```
78
-ShouldBeEmpty receives a single parameter (actual) and determines whether or not
79
-calling len(actual) would return `0`. It obeys the rules specified by the len
80
-function for determining length: http://golang.org/pkg/builtin/#len
81
-
82
-#### func  ShouldBeFalse
83
-
84
-```go
85
-func ShouldBeFalse(actual interface{}, expected ...interface{}) string
86
-```
87
-ShouldBeFalse receives a single parameter and ensures that it is false.
88
-
89
-#### func  ShouldBeGreaterThan
90
-
91
-```go
92
-func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string
93
-```
94
-ShouldBeGreaterThan receives exactly two parameters and ensures that the first
95
-is greater than the second.
96
-
97
-#### func  ShouldBeGreaterThanOrEqualTo
98
-
99
-```go
100
-func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string
101
-```
102
-ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that
103
-the first is greater than or equal to the second.
104
-
105
-#### func  ShouldBeIn
106
-
107
-```go
108
-func ShouldBeIn(actual interface{}, expected ...interface{}) string
109
-```
110
-ShouldBeIn receives at least 2 parameters. The first is a proposed member of the
111
-collection that is passed in either as the second parameter, or of the
112
-collection that is comprised of all the remaining parameters. This assertion
113
-ensures that the proposed member is in the collection (using ShouldEqual).
114
-
115
-#### func  ShouldBeLessThan
116
-
117
-```go
118
-func ShouldBeLessThan(actual interface{}, expected ...interface{}) string
119
-```
120
-ShouldBeLessThan receives exactly two parameters and ensures that the first is
121
-less than the second.
122
-
123
-#### func  ShouldBeLessThanOrEqualTo
124
-
125
-```go
126
-func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string
127
-```
128
-ShouldBeLessThan receives exactly two parameters and ensures that the first is
129
-less than or equal to the second.
130
-
131
-#### func  ShouldBeNil
132
-
133
-```go
134
-func ShouldBeNil(actual interface{}, expected ...interface{}) string
135
-```
136
-ShouldBeNil receives a single parameter and ensures that it is nil.
137
-
138
-#### func  ShouldBeTrue
139
-
140
-```go
141
-func ShouldBeTrue(actual interface{}, expected ...interface{}) string
142
-```
143
-ShouldBeTrue receives a single parameter and ensures that it is true.
144
-
145
-#### func  ShouldBeZeroValue
146
-
147
-```go
148
-func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string
149
-```
150
-ShouldBeZeroValue receives a single parameter and ensures that it is the Go
151
-equivalent of the default value, or "zero" value.
152
-
153
-#### func  ShouldContain
154
-
155
-```go
156
-func ShouldContain(actual interface{}, expected ...interface{}) string
157
-```
158
-ShouldContain receives exactly two parameters. The first is a slice and the
159
-second is a proposed member. Membership is determined using ShouldEqual.
160
-
161
-#### func  ShouldContainKey
162
-
163
-```go
164
-func ShouldContainKey(actual interface{}, expected ...interface{}) string
165
-```
166
-ShouldContainKey receives exactly two parameters. The first is a map and the
167
-second is a proposed key. Keys are compared with a simple '=='.
168
-
169
-#### func  ShouldContainSubstring
170
-
171
-```go
172
-func ShouldContainSubstring(actual interface{}, expected ...interface{}) string
173
-```
174
-ShouldContainSubstring receives exactly 2 string parameters and ensures that the
175
-first contains the second as a substring.
176
-
177
-#### func  ShouldEndWith
178
-
179
-```go
180
-func ShouldEndWith(actual interface{}, expected ...interface{}) string
181
-```
182
-ShouldEndWith receives exactly 2 string parameters and ensures that the first
183
-ends with the second.
184
-
185
-#### func  ShouldEqual
186
-
187
-```go
188
-func ShouldEqual(actual interface{}, expected ...interface{}) string
189
-```
190
-ShouldEqual receives exactly two parameters and does an equality check.
191
-
192
-#### func  ShouldEqualTrimSpace
193
-
194
-```go
195
-func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) string
196
-```
197
-ShouldEqualTrimSpace receives exactly 2 string parameters and ensures that the
198
-first is equal to the second after removing all leading and trailing whitespace
199
-using strings.TrimSpace(first).
200
-
201
-#### func  ShouldEqualWithout
202
-
203
-```go
204
-func ShouldEqualWithout(actual interface{}, expected ...interface{}) string
205
-```
206
-ShouldEqualWithout receives exactly 3 string parameters and ensures that the
207
-first is equal to the second after removing all instances of the third from the
208
-first using strings.Replace(first, third, "", -1).
209
-
210
-#### func  ShouldHappenAfter
211
-
212
-```go
213
-func ShouldHappenAfter(actual interface{}, expected ...interface{}) string
214
-```
215
-ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the
216
-first happens after the second.
217
-
218
-#### func  ShouldHappenBefore
219
-
220
-```go
221
-func ShouldHappenBefore(actual interface{}, expected ...interface{}) string
222
-```
223
-ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the
224
-first happens before the second.
225
-
226
-#### func  ShouldHappenBetween
227
-
228
-```go
229
-func ShouldHappenBetween(actual interface{}, expected ...interface{}) string
230
-```
231
-ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the
232
-first happens between (not on) the second and third.
233
-
234
-#### func  ShouldHappenOnOrAfter
235
-
236
-```go
237
-func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string
238
-```
239
-ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that
240
-the first happens on or after the second.
241
-
242
-#### func  ShouldHappenOnOrBefore
243
-
244
-```go
245
-func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string
246
-```
247
-ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that
248
-the first happens on or before the second.
249
-
250
-#### func  ShouldHappenOnOrBetween
251
-
252
-```go
253
-func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string
254
-```
255
-ShouldHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that
256
-the first happens between or on the second and third.
257
-
258
-#### func  ShouldHappenWithin
259
-
260
-```go
261
-func ShouldHappenWithin(actual interface{}, expected ...interface{}) string
262
-```
263
-ShouldHappenWithin receives a time.Time, a time.Duration, and a time.Time (3
264
-arguments) and asserts that the first time.Time happens within or on the
265
-duration specified relative to the other time.Time.
266
-
267
-#### func  ShouldHaveLength
268
-
269
-```go
270
-func ShouldHaveLength(actual interface{}, expected ...interface{}) string
271
-```
272
-ShouldHaveLength receives 2 parameters. The first is a collection to check the
273
-length of, the second being the expected length. It obeys the rules specified by
274
-the len function for determining length: http://golang.org/pkg/builtin/#len
275
-
276
-#### func  ShouldHaveSameTypeAs
277
-
278
-```go
279
-func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string
280
-```
281
-ShouldHaveSameTypeAs receives exactly two parameters and compares their
282
-underlying types for equality.
283
-
284
-#### func  ShouldImplement
285
-
286
-```go
287
-func ShouldImplement(actual interface{}, expectedList ...interface{}) string
288
-```
289
-ShouldImplement receives exactly two parameters and ensures that the first
290
-implements the interface type of the second.
291
-
292
-#### func  ShouldNotAlmostEqual
293
-
294
-```go
295
-func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string
296
-```
297
-ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual
298
-
299
-#### func  ShouldNotBeBetween
300
-
301
-```go
302
-func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string
303
-```
304
-ShouldNotBeBetween receives exactly three parameters: an actual value, a lower
305
-bound, and an upper bound. It ensures that the actual value is NOT between both
306
-bounds.
307
-
308
-#### func  ShouldNotBeBetweenOrEqual
309
-
310
-```go
311
-func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
312
-```
313
-ShouldNotBeBetweenOrEqual receives exactly three parameters: an actual value, a
314
-lower bound, and an upper bound. It ensures that the actual value is nopt
315
-between the bounds nor equal to either of them.
316
-
317
-#### func  ShouldNotBeBlank
318
-
319
-```go
320
-func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string
321
-```
322
-ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is
323
-equal to "".
324
-
325
-#### func  ShouldNotBeEmpty
326
-
327
-```go
328
-func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string
329
-```
330
-ShouldNotBeEmpty receives a single parameter (actual) and determines whether or
331
-not calling len(actual) would return a value greater than zero. It obeys the
332
-rules specified by the `len` function for determining length:
333
-http://golang.org/pkg/builtin/#len
334
-
335
-#### func  ShouldNotBeIn
336
-
337
-```go
338
-func ShouldNotBeIn(actual interface{}, expected ...interface{}) string
339
-```
340
-ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of
341
-the collection that is passed in either as the second parameter, or of the
342
-collection that is comprised of all the remaining parameters. This assertion
343
-ensures that the proposed member is NOT in the collection (using ShouldEqual).
344
-
345
-#### func  ShouldNotBeNil
346
-
347
-```go
348
-func ShouldNotBeNil(actual interface{}, expected ...interface{}) string
349
-```
350
-ShouldNotBeNil receives a single parameter and ensures that it is not nil.
351
-
352
-#### func  ShouldNotContain
353
-
354
-```go
355
-func ShouldNotContain(actual interface{}, expected ...interface{}) string
356
-```
357
-ShouldNotContain receives exactly two parameters. The first is a slice and the
358
-second is a proposed member. Membership is determinied using ShouldEqual.
359
-
360
-#### func  ShouldNotContainKey
361
-
362
-```go
363
-func ShouldNotContainKey(actual interface{}, expected ...interface{}) string
364
-```
365
-ShouldNotContainKey receives exactly two parameters. The first is a map and the
366
-second is a proposed absent key. Keys are compared with a simple '=='.
367
-
368
-#### func  ShouldNotContainSubstring
369
-
370
-```go
371
-func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string
372
-```
373
-ShouldNotContainSubstring receives exactly 2 string parameters and ensures that
374
-the first does NOT contain the second as a substring.
375
-
376
-#### func  ShouldNotEndWith
377
-
378
-```go
379
-func ShouldNotEndWith(actual interface{}, expected ...interface{}) string
380
-```
381
-ShouldEndWith receives exactly 2 string parameters and ensures that the first
382
-does not end with the second.
383
-
384
-#### func  ShouldNotEqual
385
-
386
-```go
387
-func ShouldNotEqual(actual interface{}, expected ...interface{}) string
388
-```
389
-ShouldNotEqual receives exactly two parameters and does an inequality check.
390
-
391
-#### func  ShouldNotHappenOnOrBetween
392
-
393
-```go
394
-func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string
395
-```
396
-ShouldNotHappenOnOrBetween receives exactly 3 time.Time arguments and asserts
397
-that the first does NOT happen between or on the second or third.
398
-
399
-#### func  ShouldNotHappenWithin
400
-
401
-```go
402
-func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string
403
-```
404
-ShouldNotHappenWithin receives a time.Time, a time.Duration, and a time.Time (3
405
-arguments) and asserts that the first time.Time does NOT happen within or on the
406
-duration specified relative to the other time.Time.
407
-
408
-#### func  ShouldNotHaveSameTypeAs
409
-
410
-```go
411
-func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string
412
-```
413
-ShouldNotHaveSameTypeAs receives exactly two parameters and compares their
414
-underlying types for inequality.
415
-
416
-#### func  ShouldNotImplement
417
-
418
-```go
419
-func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string
420
-```
421
-ShouldNotImplement receives exactly two parameters and ensures that the first
422
-does NOT implement the interface type of the second.
423
-
424
-#### func  ShouldNotPanic
425
-
426
-```go
427
-func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string)
428
-```
429
-ShouldNotPanic receives a void, niladic function and expects to execute the
430
-function without any panic.
431
-
432
-#### func  ShouldNotPanicWith
433
-
434
-```go
435
-func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string)
436
-```
437
-ShouldNotPanicWith receives a void, niladic function and expects to recover a
438
-panic whose content differs from the second argument.
439
-
440
-#### func  ShouldNotPointTo
441
-
442
-```go
443
-func ShouldNotPointTo(actual interface{}, expected ...interface{}) string
444
-```
445
-ShouldNotPointTo receives exactly two parameters and checks to see that they
446
-point to different addresess.
447
-
448
-#### func  ShouldNotResemble
449
-
450
-```go
451
-func ShouldNotResemble(actual interface{}, expected ...interface{}) string
452
-```
453
-ShouldNotResemble receives exactly two parameters and does an inverse deep equal
454
-check (see reflect.DeepEqual)
455
-
456
-#### func  ShouldNotStartWith
457
-
458
-```go
459
-func ShouldNotStartWith(actual interface{}, expected ...interface{}) string
460
-```
461
-ShouldNotStartWith receives exactly 2 string parameters and ensures that the
462
-first does not start with the second.
463
-
464
-#### func  ShouldPanic
465
-
466
-```go
467
-func ShouldPanic(actual interface{}, expected ...interface{}) (message string)
468
-```
469
-ShouldPanic receives a void, niladic function and expects to recover a panic.
470
-
471
-#### func  ShouldPanicWith
472
-
473
-```go
474
-func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string)
475
-```
476
-ShouldPanicWith receives a void, niladic function and expects to recover a panic
477
-with the second argument as the content.
478
-
479
-#### func  ShouldPointTo
480
-
481
-```go
482
-func ShouldPointTo(actual interface{}, expected ...interface{}) string
483
-```
484
-ShouldPointTo receives exactly two parameters and checks to see that they point
485
-to the same address.
486
-
487
-#### func  ShouldResemble
488
-
489
-```go
490
-func ShouldResemble(actual interface{}, expected ...interface{}) string
491
-```
492
-ShouldResemble receives exactly two parameters and does a deep equal check (see
493
-reflect.DeepEqual)
494
-
495
-#### func  ShouldStartWith
496
-
497
-```go
498
-func ShouldStartWith(actual interface{}, expected ...interface{}) string
499
-```
500
-ShouldStartWith receives exactly 2 string parameters and ensures that the first
501
-starts with the second.
502
-
503
-#### func  So
504
-
505
-```go
506
-func So(actual interface{}, assert assertion, expected ...interface{}) (bool, string)
507
-```
508
-So is a convenience function (as opposed to an inconvenience function?) for
509
-running assertions on arbitrary arguments in any context, be it for testing or
510
-even application logging. It allows you to perform assertion-like behavior (and
511
-get nicely formatted messages detailing discrepancies) but without the program
512
-blowing up or panicking. All that is required is to import this package and call
513
-`So` with one of the assertions exported by this package as the second
514
-parameter. The first return parameter is a boolean indicating if the assertion
515
-was true. The second return parameter is the well-formatted message showing why
516
-an assertion was incorrect, or blank if the assertion was correct.
517
-
518
-Example:
519
-
520
-    if ok, message := So(x, ShouldBeGreaterThan, y); !ok {
521
-         log.Println(message)
522
-    }
523
-
524
-#### type Assertion
525
-
526
-```go
527
-type Assertion struct {
528
-}
529
-```
530
-
531
-
532
-#### func  New
533
-
534
-```go
535
-func New(t testingT) *Assertion
536
-```
537
-New swallows the *testing.T struct and prints failed assertions using t.Error.
538
-Example: assertions.New(t).So(1, should.Equal, 1)
539
-
540
-#### func (*Assertion) Failed
541
-
542
-```go
543
-func (this *Assertion) Failed() bool
544
-```
545
-Failed reports whether any calls to So (on this Assertion instance) have failed.
546
-
547
-#### func (*Assertion) So
548
-
549
-```go
550
-func (this *Assertion) So(actual interface{}, assert assertion, expected ...interface{}) bool
551
-```
552
-So calls the standalone So function and additionally, calls t.Error in failure
553
-scenarios.
554
-
555
-#### type FailureView
556
-
557
-```go
558
-type FailureView struct {
559
-	Message  string `json:"Message"`
560
-	Expected string `json:"Expected"`
561
-	Actual   string `json:"Actual"`
562
-}
563
-```
564
-
565
-This struct is also declared in
566
-github.com/smartystreets/goconvey/convey/reporting. The json struct tags should
567
-be equal in both declarations.
568
-
569
-#### type Serializer
570
-
571
-```go
572
-type Serializer interface {
573
-	// contains filtered or unexported methods
574
-}
575
-```

+ 0 - 3
vendor/github.com/smartystreets/assertions/assertions.goconvey

@@ -1,3 +0,0 @@
1
-#ignore
2
--timeout=1s
3
--coverpkg=github.com/smartystreets/assertions,github.com/smartystreets/assertions/internal/oglematchers

+ 0 - 244
vendor/github.com/smartystreets/assertions/collections.go

@@ -1,244 +0,0 @@
1
-package assertions
2
-
3
-import (
4
-	"fmt"
5
-	"reflect"
6
-
7
-	"github.com/smartystreets/assertions/internal/oglematchers"
8
-)
9
-
10
-// ShouldContain receives exactly two parameters. The first is a slice and the
11
-// second is a proposed member. Membership is determined using ShouldEqual.
12
-func ShouldContain(actual interface{}, expected ...interface{}) string {
13
-	if fail := need(1, expected); fail != success {
14
-		return fail
15
-	}
16
-
17
-	if matchError := oglematchers.Contains(expected[0]).Matches(actual); matchError != nil {
18
-		typeName := reflect.TypeOf(actual)
19
-
20
-		if fmt.Sprintf("%v", matchError) == "which is not a slice or array" {
21
-			return fmt.Sprintf(shouldHaveBeenAValidCollection, typeName)
22
-		}
23
-		return fmt.Sprintf(shouldHaveContained, typeName, expected[0])
24
-	}
25
-	return success
26
-}
27
-
28
-// ShouldNotContain receives exactly two parameters. The first is a slice and the
29
-// second is a proposed member. Membership is determinied using ShouldEqual.
30
-func ShouldNotContain(actual interface{}, expected ...interface{}) string {
31
-	if fail := need(1, expected); fail != success {
32
-		return fail
33
-	}
34
-	typeName := reflect.TypeOf(actual)
35
-
36
-	if matchError := oglematchers.Contains(expected[0]).Matches(actual); matchError != nil {
37
-		if fmt.Sprintf("%v", matchError) == "which is not a slice or array" {
38
-			return fmt.Sprintf(shouldHaveBeenAValidCollection, typeName)
39
-		}
40
-		return success
41
-	}
42
-	return fmt.Sprintf(shouldNotHaveContained, typeName, expected[0])
43
-}
44
-
45
-// ShouldContainKey receives exactly two parameters. The first is a map and the
46
-// second is a proposed key. Keys are compared with a simple '=='.
47
-func ShouldContainKey(actual interface{}, expected ...interface{}) string {
48
-	if fail := need(1, expected); fail != success {
49
-		return fail
50
-	}
51
-
52
-	keys, isMap := mapKeys(actual)
53
-	if !isMap {
54
-		return fmt.Sprintf(shouldHaveBeenAValidMap, reflect.TypeOf(actual))
55
-	}
56
-
57
-	if !keyFound(keys, expected[0]) {
58
-		return fmt.Sprintf(shouldHaveContainedKey, reflect.TypeOf(actual), expected)
59
-	}
60
-
61
-	return ""
62
-}
63
-
64
-// ShouldNotContainKey receives exactly two parameters. The first is a map and the
65
-// second is a proposed absent key. Keys are compared with a simple '=='.
66
-func ShouldNotContainKey(actual interface{}, expected ...interface{}) string {
67
-	if fail := need(1, expected); fail != success {
68
-		return fail
69
-	}
70
-
71
-	keys, isMap := mapKeys(actual)
72
-	if !isMap {
73
-		return fmt.Sprintf(shouldHaveBeenAValidMap, reflect.TypeOf(actual))
74
-	}
75
-
76
-	if keyFound(keys, expected[0]) {
77
-		return fmt.Sprintf(shouldNotHaveContainedKey, reflect.TypeOf(actual), expected)
78
-	}
79
-
80
-	return ""
81
-}
82
-
83
-func mapKeys(m interface{}) ([]reflect.Value, bool) {
84
-	value := reflect.ValueOf(m)
85
-	if value.Kind() != reflect.Map {
86
-		return nil, false
87
-	}
88
-	return value.MapKeys(), true
89
-}
90
-func keyFound(keys []reflect.Value, expectedKey interface{}) bool {
91
-	found := false
92
-	for _, key := range keys {
93
-		if key.Interface() == expectedKey {
94
-			found = true
95
-		}
96
-	}
97
-	return found
98
-}
99
-
100
-// ShouldBeIn receives at least 2 parameters. The first is a proposed member of the collection
101
-// that is passed in either as the second parameter, or of the collection that is comprised
102
-// of all the remaining parameters. This assertion ensures that the proposed member is in
103
-// the collection (using ShouldEqual).
104
-func ShouldBeIn(actual interface{}, expected ...interface{}) string {
105
-	if fail := atLeast(1, expected); fail != success {
106
-		return fail
107
-	}
108
-
109
-	if len(expected) == 1 {
110
-		return shouldBeIn(actual, expected[0])
111
-	}
112
-	return shouldBeIn(actual, expected)
113
-}
114
-func shouldBeIn(actual interface{}, expected interface{}) string {
115
-	if matchError := oglematchers.Contains(actual).Matches(expected); matchError != nil {
116
-		return fmt.Sprintf(shouldHaveBeenIn, actual, reflect.TypeOf(expected))
117
-	}
118
-	return success
119
-}
120
-
121
-// ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of the collection
122
-// that is passed in either as the second parameter, or of the collection that is comprised
123
-// of all the remaining parameters. This assertion ensures that the proposed member is NOT in
124
-// the collection (using ShouldEqual).
125
-func ShouldNotBeIn(actual interface{}, expected ...interface{}) string {
126
-	if fail := atLeast(1, expected); fail != success {
127
-		return fail
128
-	}
129
-
130
-	if len(expected) == 1 {
131
-		return shouldNotBeIn(actual, expected[0])
132
-	}
133
-	return shouldNotBeIn(actual, expected)
134
-}
135
-func shouldNotBeIn(actual interface{}, expected interface{}) string {
136
-	if matchError := oglematchers.Contains(actual).Matches(expected); matchError == nil {
137
-		return fmt.Sprintf(shouldNotHaveBeenIn, actual, reflect.TypeOf(expected))
138
-	}
139
-	return success
140
-}
141
-
142
-// ShouldBeEmpty receives a single parameter (actual) and determines whether or not
143
-// calling len(actual) would return `0`. It obeys the rules specified by the len
144
-// function for determining length: http://golang.org/pkg/builtin/#len
145
-func ShouldBeEmpty(actual interface{}, expected ...interface{}) string {
146
-	if fail := need(0, expected); fail != success {
147
-		return fail
148
-	}
149
-
150
-	if actual == nil {
151
-		return success
152
-	}
153
-
154
-	value := reflect.ValueOf(actual)
155
-	switch value.Kind() {
156
-	case reflect.Slice:
157
-		if value.Len() == 0 {
158
-			return success
159
-		}
160
-	case reflect.Chan:
161
-		if value.Len() == 0 {
162
-			return success
163
-		}
164
-	case reflect.Map:
165
-		if value.Len() == 0 {
166
-			return success
167
-		}
168
-	case reflect.String:
169
-		if value.Len() == 0 {
170
-			return success
171
-		}
172
-	case reflect.Ptr:
173
-		elem := value.Elem()
174
-		kind := elem.Kind()
175
-		if (kind == reflect.Slice || kind == reflect.Array) && elem.Len() == 0 {
176
-			return success
177
-		}
178
-	}
179
-
180
-	return fmt.Sprintf(shouldHaveBeenEmpty, actual)
181
-}
182
-
183
-// ShouldNotBeEmpty receives a single parameter (actual) and determines whether or not
184
-// calling len(actual) would return a value greater than zero. It obeys the rules
185
-// specified by the `len` function for determining length: http://golang.org/pkg/builtin/#len
186
-func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string {
187
-	if fail := need(0, expected); fail != success {
188
-		return fail
189
-	}
190
-
191
-	if empty := ShouldBeEmpty(actual, expected...); empty != success {
192
-		return success
193
-	}
194
-	return fmt.Sprintf(shouldNotHaveBeenEmpty, actual)
195
-}
196
-
197
-// ShouldHaveLength receives 2 parameters. The first is a collection to check
198
-// the length of, the second being the expected length. It obeys the rules
199
-// specified by the len function for determining length:
200
-// http://golang.org/pkg/builtin/#len
201
-func ShouldHaveLength(actual interface{}, expected ...interface{}) string {
202
-	if fail := need(1, expected); fail != success {
203
-		return fail
204
-	}
205
-
206
-	var expectedLen int64
207
-	lenValue := reflect.ValueOf(expected[0])
208
-	switch lenValue.Kind() {
209
-	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
210
-		expectedLen = lenValue.Int()
211
-	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
212
-		expectedLen = int64(lenValue.Uint())
213
-	default:
214
-		return fmt.Sprintf(shouldHaveBeenAValidInteger, reflect.TypeOf(expected[0]))
215
-	}
216
-
217
-	if expectedLen < 0 {
218
-		return fmt.Sprintf(shouldHaveBeenAValidLength, expected[0])
219
-	}
220
-
221
-	value := reflect.ValueOf(actual)
222
-	switch value.Kind() {
223
-	case reflect.Slice,
224
-		reflect.Chan,
225
-		reflect.Map,
226
-		reflect.String:
227
-		if int64(value.Len()) == expectedLen {
228
-			return success
229
-		} else {
230
-			return fmt.Sprintf(shouldHaveHadLength, actual, value.Len(), expectedLen)
231
-		}
232
-	case reflect.Ptr:
233
-		elem := value.Elem()
234
-		kind := elem.Kind()
235
-		if kind == reflect.Slice || kind == reflect.Array {
236
-			if int64(elem.Len()) == expectedLen {
237
-				return success
238
-			} else {
239
-				return fmt.Sprintf(shouldHaveHadLength, actual, elem.Len(), expectedLen)
240
-			}
241
-		}
242
-	}
243
-	return fmt.Sprintf(shouldHaveBeenAValidCollection, reflect.TypeOf(actual))
244
-}

+ 0 - 105
vendor/github.com/smartystreets/assertions/doc.go

@@ -1,105 +0,0 @@
1
-// Package assertions contains the implementations for all assertions which
2
-// are referenced in goconvey's `convey` package
3
-// (github.com/smartystreets/goconvey/convey) and gunit (github.com/smartystreets/gunit)
4
-// for use with the So(...) method.
5
-// They can also be used in traditional Go test functions and even in
6
-// applications.
7
-//
8
-// Many of the assertions lean heavily on work done by Aaron Jacobs in his excellent oglematchers library.
9
-// (https://github.com/jacobsa/oglematchers)
10
-// The ShouldResemble assertion leans heavily on work done by Daniel Jacques in his very helpful go-render library.
11
-// (https://github.com/luci/go-render)
12
-package assertions
13
-
14
-import (
15
-	"fmt"
16
-	"runtime"
17
-)
18
-
19
-// By default we use a no-op serializer. The actual Serializer provides a JSON
20
-// representation of failure results on selected assertions so the goconvey
21
-// web UI can display a convenient diff.
22
-var serializer Serializer = new(noopSerializer)
23
-
24
-// GoConveyMode provides control over JSON serialization of failures. When
25
-// using the assertions in this package from the convey package JSON results
26
-// are very helpful and can be rendered in a DIFF view. In that case, this function
27
-// will be called with a true value to enable the JSON serialization. By default,
28
-// the assertions in this package will not serializer a JSON result, making
29
-// standalone ussage more convenient.
30
-func GoConveyMode(yes bool) {
31
-	if yes {
32
-		serializer = newSerializer()
33
-	} else {
34
-		serializer = new(noopSerializer)
35
-	}
36
-}
37
-
38
-type testingT interface {
39
-	Error(args ...interface{})
40
-}
41
-
42
-type Assertion struct {
43
-	t      testingT
44
-	failed bool
45
-}
46
-
47
-// New swallows the *testing.T struct and prints failed assertions using t.Error.
48
-// Example: assertions.New(t).So(1, should.Equal, 1)
49
-func New(t testingT) *Assertion {
50
-	return &Assertion{t: t}
51
-}
52
-
53
-// Failed reports whether any calls to So (on this Assertion instance) have failed.
54
-func (this *Assertion) Failed() bool {
55
-	return this.failed
56
-}
57
-
58
-// So calls the standalone So function and additionally, calls t.Error in failure scenarios.
59
-func (this *Assertion) So(actual interface{}, assert assertion, expected ...interface{}) bool {
60
-	ok, result := So(actual, assert, expected...)
61
-	if !ok {
62
-		this.failed = true
63
-		_, file, line, _ := runtime.Caller(1)
64
-		this.t.Error(fmt.Sprintf("\n%s:%d\n%s", file, line, result))
65
-	}
66
-	return ok
67
-}
68
-
69
-// So is a convenience function (as opposed to an inconvenience function?)
70
-// for running assertions on arbitrary arguments in any context, be it for testing or even
71
-// application logging. It allows you to perform assertion-like behavior (and get nicely
72
-// formatted messages detailing discrepancies) but without the program blowing up or panicking.
73
-// All that is required is to import this package and call `So` with one of the assertions
74
-// exported by this package as the second parameter.
75
-// The first return parameter is a boolean indicating if the assertion was true. The second
76
-// return parameter is the well-formatted message showing why an assertion was incorrect, or
77
-// blank if the assertion was correct.
78
-//
79
-// Example:
80
-//
81
-//   if ok, message := So(x, ShouldBeGreaterThan, y); !ok {
82
-//        log.Println(message)
83
-//   }
84
-//
85
-func So(actual interface{}, assert assertion, expected ...interface{}) (bool, string) {
86
-	if result := so(actual, assert, expected...); len(result) == 0 {
87
-		return true, result
88
-	} else {
89
-		return false, result
90
-	}
91
-}
92
-
93
-// so is like So, except that it only returns the string message, which is blank if the
94
-// assertion passed. Used to facilitate testing.
95
-func so(actual interface{}, assert func(interface{}, ...interface{}) string, expected ...interface{}) string {
96
-	return assert(actual, expected...)
97
-}
98
-
99
-// assertion is an alias for a function with a signature that the So()
100
-// function can handle. Any future or custom assertions should conform to this
101
-// method signature. The return value should be an empty string if the assertion
102
-// passes and a well-formed failure message if not.
103
-type assertion func(actual interface{}, expected ...interface{}) string
104
-
105
-////////////////////////////////////////////////////////////////////////////

+ 0 - 280
vendor/github.com/smartystreets/assertions/equality.go

@@ -1,280 +0,0 @@
1
-package assertions
2
-
3
-import (
4
-	"errors"
5
-	"fmt"
6
-	"math"
7
-	"reflect"
8
-	"strings"
9
-
10
-	"github.com/smartystreets/assertions/internal/oglematchers"
11
-	"github.com/smartystreets/assertions/internal/go-render/render"
12
-)
13
-
14
-// default acceptable delta for ShouldAlmostEqual
15
-const defaultDelta = 0.0000000001
16
-
17
-// ShouldEqual receives exactly two parameters and does an equality check.
18
-func ShouldEqual(actual interface{}, expected ...interface{}) string {
19
-	if message := need(1, expected); message != success {
20
-		return message
21
-	}
22
-	return shouldEqual(actual, expected[0])
23
-}
24
-func shouldEqual(actual, expected interface{}) (message string) {
25
-	defer func() {
26
-		if r := recover(); r != nil {
27
-			message = serializer.serialize(expected, actual, fmt.Sprintf(shouldHaveBeenEqual, expected, actual))
28
-			return
29
-		}
30
-	}()
31
-
32
-	if matchError := oglematchers.Equals(expected).Matches(actual); matchError != nil {
33
-		expectedSyntax := fmt.Sprintf("%v", expected)
34
-		actualSyntax := fmt.Sprintf("%v", actual)
35
-		if expectedSyntax == actualSyntax && reflect.TypeOf(expected) != reflect.TypeOf(actual) {
36
-			message = fmt.Sprintf(shouldHaveBeenEqualTypeMismatch, expected, expected, actual, actual)
37
-		} else {
38
-			message = fmt.Sprintf(shouldHaveBeenEqual, expected, actual)
39
-		}
40
-		message = serializer.serialize(expected, actual, message)
41
-		return
42
-	}
43
-
44
-	return success
45
-}
46
-
47
-// ShouldNotEqual receives exactly two parameters and does an inequality check.
48
-func ShouldNotEqual(actual interface{}, expected ...interface{}) string {
49
-	if fail := need(1, expected); fail != success {
50
-		return fail
51
-	} else if ShouldEqual(actual, expected[0]) == success {
52
-		return fmt.Sprintf(shouldNotHaveBeenEqual, actual, expected[0])
53
-	}
54
-	return success
55
-}
56
-
57
-// ShouldAlmostEqual makes sure that two parameters are close enough to being equal.
58
-// The acceptable delta may be specified with a third argument,
59
-// or a very small default delta will be used.
60
-func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string {
61
-	actualFloat, expectedFloat, deltaFloat, err := cleanAlmostEqualInput(actual, expected...)
62
-
63
-	if err != "" {
64
-		return err
65
-	}
66
-
67
-	if math.Abs(actualFloat-expectedFloat) <= deltaFloat {
68
-		return success
69
-	} else {
70
-		return fmt.Sprintf(shouldHaveBeenAlmostEqual, actualFloat, expectedFloat)
71
-	}
72
-}
73
-
74
-// ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual
75
-func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string {
76
-	actualFloat, expectedFloat, deltaFloat, err := cleanAlmostEqualInput(actual, expected...)
77
-
78
-	if err != "" {
79
-		return err
80
-	}
81
-
82
-	if math.Abs(actualFloat-expectedFloat) > deltaFloat {
83
-		return success
84
-	} else {
85
-		return fmt.Sprintf(shouldHaveNotBeenAlmostEqual, actualFloat, expectedFloat)
86
-	}
87
-}
88
-
89
-func cleanAlmostEqualInput(actual interface{}, expected ...interface{}) (float64, float64, float64, string) {
90
-	deltaFloat := 0.0000000001
91
-
92
-	if len(expected) == 0 {
93
-		return 0.0, 0.0, 0.0, "This assertion requires exactly one comparison value and an optional delta (you provided neither)"
94
-	} else if len(expected) == 2 {
95
-		delta, err := getFloat(expected[1])
96
-
97
-		if err != nil {
98
-			return 0.0, 0.0, 0.0, "delta must be a numerical type"
99
-		}
100
-
101
-		deltaFloat = delta
102
-	} else if len(expected) > 2 {
103
-		return 0.0, 0.0, 0.0, "This assertion requires exactly one comparison value and an optional delta (you provided more values)"
104
-	}
105
-
106
-	actualFloat, err := getFloat(actual)
107
-
108
-	if err != nil {
109
-		return 0.0, 0.0, 0.0, err.Error()
110
-	}
111
-
112
-	expectedFloat, err := getFloat(expected[0])
113
-
114
-	if err != nil {
115
-		return 0.0, 0.0, 0.0, err.Error()
116
-	}
117
-
118
-	return actualFloat, expectedFloat, deltaFloat, ""
119
-}
120
-
121
-// returns the float value of any real number, or error if it is not a numerical type
122
-func getFloat(num interface{}) (float64, error) {
123
-	numValue := reflect.ValueOf(num)
124
-	numKind := numValue.Kind()
125
-
126
-	if numKind == reflect.Int ||
127
-		numKind == reflect.Int8 ||
128
-		numKind == reflect.Int16 ||
129
-		numKind == reflect.Int32 ||
130
-		numKind == reflect.Int64 {
131
-		return float64(numValue.Int()), nil
132
-	} else if numKind == reflect.Uint ||
133
-		numKind == reflect.Uint8 ||
134
-		numKind == reflect.Uint16 ||
135
-		numKind == reflect.Uint32 ||
136
-		numKind == reflect.Uint64 {
137
-		return float64(numValue.Uint()), nil
138
-	} else if numKind == reflect.Float32 ||
139
-		numKind == reflect.Float64 {
140
-		return numValue.Float(), nil
141
-	} else {
142
-		return 0.0, errors.New("must be a numerical type, but was " + numKind.String())
143
-	}
144
-}
145
-
146
-// ShouldResemble receives exactly two parameters and does a deep equal check (see reflect.DeepEqual)
147
-func ShouldResemble(actual interface{}, expected ...interface{}) string {
148
-	if message := need(1, expected); message != success {
149
-		return message
150
-	}
151
-
152
-	if matchError := oglematchers.DeepEquals(expected[0]).Matches(actual); matchError != nil {
153
-		return serializer.serializeDetailed(expected[0], actual,
154
-			fmt.Sprintf(shouldHaveResembled, render.Render(expected[0]), render.Render(actual)))
155
-	}
156
-
157
-	return success
158
-}
159
-
160
-// ShouldNotResemble receives exactly two parameters and does an inverse deep equal check (see reflect.DeepEqual)
161
-func ShouldNotResemble(actual interface{}, expected ...interface{}) string {
162
-	if message := need(1, expected); message != success {
163
-		return message
164
-	} else if ShouldResemble(actual, expected[0]) == success {
165
-		return fmt.Sprintf(shouldNotHaveResembled, render.Render(actual), render.Render(expected[0]))
166
-	}
167
-	return success
168
-}
169
-
170
-// ShouldPointTo receives exactly two parameters and checks to see that they point to the same address.
171
-func ShouldPointTo(actual interface{}, expected ...interface{}) string {
172
-	if message := need(1, expected); message != success {
173
-		return message
174
-	}
175
-	return shouldPointTo(actual, expected[0])
176
-
177
-}
178
-func shouldPointTo(actual, expected interface{}) string {
179
-	actualValue := reflect.ValueOf(actual)
180
-	expectedValue := reflect.ValueOf(expected)
181
-
182
-	if ShouldNotBeNil(actual) != success {
183
-		return fmt.Sprintf(shouldHaveBeenNonNilPointer, "first", "nil")
184
-	} else if ShouldNotBeNil(expected) != success {
185
-		return fmt.Sprintf(shouldHaveBeenNonNilPointer, "second", "nil")
186
-	} else if actualValue.Kind() != reflect.Ptr {
187
-		return fmt.Sprintf(shouldHaveBeenNonNilPointer, "first", "not")
188
-	} else if expectedValue.Kind() != reflect.Ptr {
189
-		return fmt.Sprintf(shouldHaveBeenNonNilPointer, "second", "not")
190
-	} else if ShouldEqual(actualValue.Pointer(), expectedValue.Pointer()) != success {
191
-		actualAddress := reflect.ValueOf(actual).Pointer()
192
-		expectedAddress := reflect.ValueOf(expected).Pointer()
193
-		return serializer.serialize(expectedAddress, actualAddress, fmt.Sprintf(shouldHavePointedTo,
194
-			actual, actualAddress,
195
-			expected, expectedAddress))
196
-	}
197
-	return success
198
-}
199
-
200
-// ShouldNotPointTo receives exactly two parameters and checks to see that they point to different addresess.
201
-func ShouldNotPointTo(actual interface{}, expected ...interface{}) string {
202
-	if message := need(1, expected); message != success {
203
-		return message
204
-	}
205
-	compare := ShouldPointTo(actual, expected[0])
206
-	if strings.HasPrefix(compare, shouldBePointers) {
207
-		return compare
208
-	} else if compare == success {
209
-		return fmt.Sprintf(shouldNotHavePointedTo, actual, expected[0], reflect.ValueOf(actual).Pointer())
210
-	}
211
-	return success
212
-}
213
-
214
-// ShouldBeNil receives a single parameter and ensures that it is nil.
215
-func ShouldBeNil(actual interface{}, expected ...interface{}) string {
216
-	if fail := need(0, expected); fail != success {
217
-		return fail
218
-	} else if actual == nil {
219
-		return success
220
-	} else if interfaceHasNilValue(actual) {
221
-		return success
222
-	}
223
-	return fmt.Sprintf(shouldHaveBeenNil, actual)
224
-}
225
-func interfaceHasNilValue(actual interface{}) bool {
226
-	value := reflect.ValueOf(actual)
227
-	kind := value.Kind()
228
-	nilable := kind == reflect.Slice ||
229
-		kind == reflect.Chan ||
230
-		kind == reflect.Func ||
231
-		kind == reflect.Ptr ||
232
-		kind == reflect.Map
233
-
234
-	// Careful: reflect.Value.IsNil() will panic unless it's an interface, chan, map, func, slice, or ptr
235
-	// Reference: http://golang.org/pkg/reflect/#Value.IsNil
236
-	return nilable && value.IsNil()
237
-}
238
-
239
-// ShouldNotBeNil receives a single parameter and ensures that it is not nil.
240
-func ShouldNotBeNil(actual interface{}, expected ...interface{}) string {
241
-	if fail := need(0, expected); fail != success {
242
-		return fail
243
-	} else if ShouldBeNil(actual) == success {
244
-		return fmt.Sprintf(shouldNotHaveBeenNil, actual)
245
-	}
246
-	return success
247
-}
248
-
249
-// ShouldBeTrue receives a single parameter and ensures that it is true.
250
-func ShouldBeTrue(actual interface{}, expected ...interface{}) string {
251
-	if fail := need(0, expected); fail != success {
252
-		return fail
253
-	} else if actual != true {
254
-		return fmt.Sprintf(shouldHaveBeenTrue, actual)
255
-	}
256
-	return success
257
-}
258
-
259
-// ShouldBeFalse receives a single parameter and ensures that it is false.
260
-func ShouldBeFalse(actual interface{}, expected ...interface{}) string {
261
-	if fail := need(0, expected); fail != success {
262
-		return fail
263
-	} else if actual != false {
264
-		return fmt.Sprintf(shouldHaveBeenFalse, actual)
265
-	}
266
-	return success
267
-}
268
-
269
-// ShouldBeZeroValue receives a single parameter and ensures that it is
270
-// the Go equivalent of the default value, or "zero" value.
271
-func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string {
272
-	if fail := need(0, expected); fail != success {
273
-		return fail
274
-	}
275
-	zeroVal := reflect.Zero(reflect.TypeOf(actual)).Interface()
276
-	if !reflect.DeepEqual(zeroVal, actual) {
277
-		return serializer.serialize(zeroVal, actual, fmt.Sprintf(shouldHaveBeenZeroValue, actual))
278
-	}
279
-	return success
280
-}

+ 0 - 23
vendor/github.com/smartystreets/assertions/filter.go

@@ -1,23 +0,0 @@
1
-package assertions
2
-
3
-import "fmt"
4
-
5
-const (
6
-	success                = ""
7
-	needExactValues        = "This assertion requires exactly %d comparison values (you provided %d)."
8
-	needNonEmptyCollection = "This assertion requires at least 1 comparison value (you provided 0)."
9
-)
10
-
11
-func need(needed int, expected []interface{}) string {
12
-	if len(expected) != needed {
13
-		return fmt.Sprintf(needExactValues, needed, len(expected))
14
-	}
15
-	return success
16
-}
17
-
18
-func atLeast(minimum int, expected []interface{}) string {
19
-	if len(expected) < 1 {
20
-		return needNonEmptyCollection
21
-	}
22
-	return success
23
-}

+ 0 - 27
vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE

@@ -1,27 +0,0 @@
1
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
2
-//
3
-// Redistribution and use in source and binary forms, with or without
4
-// modification, are permitted provided that the following conditions are
5
-// met:
6
-//
7
-//    * Redistributions of source code must retain the above copyright
8
-// notice, this list of conditions and the following disclaimer.
9
-//    * Redistributions in binary form must reproduce the above
10
-// copyright notice, this list of conditions and the following disclaimer
11
-// in the documentation and/or other materials provided with the
12
-// distribution.
13
-//    * Neither the name of Google Inc. nor the names of its
14
-// contributors may be used to endorse or promote products derived from
15
-// this software without specific prior written permission.
16
-//
17
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 477
vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go

@@ -1,477 +0,0 @@
1
-// Copyright 2015 The Chromium Authors. All rights reserved.
2
-// Use of this source code is governed by a BSD-style license that can be
3
-// found in the LICENSE file.
4
-
5
-package render
6
-
7
-import (
8
-	"bytes"
9
-	"fmt"
10
-	"reflect"
11
-	"sort"
12
-	"strconv"
13
-)
14
-
15
-var builtinTypeMap = map[reflect.Kind]string{
16
-	reflect.Bool:       "bool",
17
-	reflect.Complex128: "complex128",
18
-	reflect.Complex64:  "complex64",
19
-	reflect.Float32:    "float32",
20
-	reflect.Float64:    "float64",
21
-	reflect.Int16:      "int16",
22
-	reflect.Int32:      "int32",
23
-	reflect.Int64:      "int64",
24
-	reflect.Int8:       "int8",
25
-	reflect.Int:        "int",
26
-	reflect.String:     "string",
27
-	reflect.Uint16:     "uint16",
28
-	reflect.Uint32:     "uint32",
29
-	reflect.Uint64:     "uint64",
30
-	reflect.Uint8:      "uint8",
31
-	reflect.Uint:       "uint",
32
-	reflect.Uintptr:    "uintptr",
33
-}
34
-
35
-var builtinTypeSet = map[string]struct{}{}
36
-
37
-func init() {
38
-	for _, v := range builtinTypeMap {
39
-		builtinTypeSet[v] = struct{}{}
40
-	}
41
-}
42
-
43
-var typeOfString = reflect.TypeOf("")
44
-var typeOfInt = reflect.TypeOf(int(1))
45
-var typeOfUint = reflect.TypeOf(uint(1))
46
-var typeOfFloat = reflect.TypeOf(10.1)
47
-
48
-// Render converts a structure to a string representation. Unline the "%#v"
49
-// format string, this resolves pointer types' contents in structs, maps, and
50
-// slices/arrays and prints their field values.
51
-func Render(v interface{}) string {
52
-	buf := bytes.Buffer{}
53
-	s := (*traverseState)(nil)
54
-	s.render(&buf, 0, reflect.ValueOf(v), false)
55
-	return buf.String()
56
-}
57
-
58
-// renderPointer is called to render a pointer value.
59
-//
60
-// This is overridable so that the test suite can have deterministic pointer
61
-// values in its expectations.
62
-var renderPointer = func(buf *bytes.Buffer, p uintptr) {
63
-	fmt.Fprintf(buf, "0x%016x", p)
64
-}
65
-
66
-// traverseState is used to note and avoid recursion as struct members are being
67
-// traversed.
68
-//
69
-// traverseState is allowed to be nil. Specifically, the root state is nil.
70
-type traverseState struct {
71
-	parent *traverseState
72
-	ptr    uintptr
73
-}
74
-
75
-func (s *traverseState) forkFor(ptr uintptr) *traverseState {
76
-	for cur := s; cur != nil; cur = cur.parent {
77
-		if ptr == cur.ptr {
78
-			return nil
79
-		}
80
-	}
81
-
82
-	fs := &traverseState{
83
-		parent: s,
84
-		ptr:    ptr,
85
-	}
86
-	return fs
87
-}
88
-
89
-func (s *traverseState) render(buf *bytes.Buffer, ptrs int, v reflect.Value, implicit bool) {
90
-	if v.Kind() == reflect.Invalid {
91
-		buf.WriteString("nil")
92
-		return
93
-	}
94
-	vt := v.Type()
95
-
96
-	// If the type being rendered is a potentially recursive type (a type that
97
-	// can contain itself as a member), we need to avoid recursion.
98
-	//
99
-	// If we've already seen this type before, mark that this is the case and
100
-	// write a recursion placeholder instead of actually rendering it.
101
-	//
102
-	// If we haven't seen it before, fork our `seen` tracking so any higher-up
103
-	// renderers will also render it at least once, then mark that we've seen it
104
-	// to avoid recursing on lower layers.
105
-	pe := uintptr(0)
106
-	vk := vt.Kind()
107
-	switch vk {
108
-	case reflect.Ptr:
109
-		// Since structs and arrays aren't pointers, they can't directly be
110
-		// recursed, but they can contain pointers to themselves. Record their
111
-		// pointer to avoid this.
112
-		switch v.Elem().Kind() {
113
-		case reflect.Struct, reflect.Array:
114
-			pe = v.Pointer()
115
-		}
116
-
117
-	case reflect.Slice, reflect.Map:
118
-		pe = v.Pointer()
119
-	}
120
-	if pe != 0 {
121
-		s = s.forkFor(pe)
122
-		if s == nil {
123
-			buf.WriteString("<REC(")
124
-			if !implicit {
125
-				writeType(buf, ptrs, vt)
126
-			}
127
-			buf.WriteString(")>")
128
-			return
129
-		}
130
-	}
131
-
132
-	isAnon := func(t reflect.Type) bool {
133
-		if t.Name() != "" {
134
-			if _, ok := builtinTypeSet[t.Name()]; !ok {
135
-				return false
136
-			}
137
-		}
138
-		return t.Kind() != reflect.Interface
139
-	}
140
-
141
-	switch vk {
142
-	case reflect.Struct:
143
-		if !implicit {
144
-			writeType(buf, ptrs, vt)
145
-		}
146
-		structAnon := vt.Name() == ""
147
-		buf.WriteRune('{')
148
-		for i := 0; i < vt.NumField(); i++ {
149
-			if i > 0 {
150
-				buf.WriteString(", ")
151
-			}
152
-			anon := structAnon && isAnon(vt.Field(i).Type)
153
-
154
-			if !anon {
155
-				buf.WriteString(vt.Field(i).Name)
156
-				buf.WriteRune(':')
157
-			}
158
-
159
-			s.render(buf, 0, v.Field(i), anon)
160
-		}
161
-		buf.WriteRune('}')
162
-
163
-	case reflect.Slice:
164
-		if v.IsNil() {
165
-			if !implicit {
166
-				writeType(buf, ptrs, vt)
167
-				buf.WriteString("(nil)")
168
-			} else {
169
-				buf.WriteString("nil")
170
-			}
171
-			return
172
-		}
173
-		fallthrough
174
-
175
-	case reflect.Array:
176
-		if !implicit {
177
-			writeType(buf, ptrs, vt)
178
-		}
179
-		anon := vt.Name() == "" && isAnon(vt.Elem())
180
-		buf.WriteString("{")
181
-		for i := 0; i < v.Len(); i++ {
182
-			if i > 0 {
183
-				buf.WriteString(", ")
184
-			}
185
-
186
-			s.render(buf, 0, v.Index(i), anon)
187
-		}
188
-		buf.WriteRune('}')
189
-
190
-	case reflect.Map:
191
-		if !implicit {
192
-			writeType(buf, ptrs, vt)
193
-		}
194
-		if v.IsNil() {
195
-			buf.WriteString("(nil)")
196
-		} else {
197
-			buf.WriteString("{")
198
-
199
-			mkeys := v.MapKeys()
200
-			tryAndSortMapKeys(vt, mkeys)
201
-
202
-			kt := vt.Key()
203
-			keyAnon := typeOfString.ConvertibleTo(kt) || typeOfInt.ConvertibleTo(kt) || typeOfUint.ConvertibleTo(kt) || typeOfFloat.ConvertibleTo(kt)
204
-			valAnon := vt.Name() == "" && isAnon(vt.Elem())
205
-			for i, mk := range mkeys {
206
-				if i > 0 {
207
-					buf.WriteString(", ")
208
-				}
209
-
210
-				s.render(buf, 0, mk, keyAnon)
211
-				buf.WriteString(":")
212
-				s.render(buf, 0, v.MapIndex(mk), valAnon)
213
-			}
214
-			buf.WriteRune('}')
215
-		}
216
-
217
-	case reflect.Ptr:
218
-		ptrs++
219
-		fallthrough
220
-	case reflect.Interface:
221
-		if v.IsNil() {
222
-			writeType(buf, ptrs, v.Type())
223
-			buf.WriteString("(nil)")
224
-		} else {
225
-			s.render(buf, ptrs, v.Elem(), false)
226
-		}
227
-
228
-	case reflect.Chan, reflect.Func, reflect.UnsafePointer:
229
-		writeType(buf, ptrs, vt)
230
-		buf.WriteRune('(')
231
-		renderPointer(buf, v.Pointer())
232
-		buf.WriteRune(')')
233
-
234
-	default:
235
-		tstr := vt.String()
236
-		implicit = implicit || (ptrs == 0 && builtinTypeMap[vk] == tstr)
237
-		if !implicit {
238
-			writeType(buf, ptrs, vt)
239
-			buf.WriteRune('(')
240
-		}
241
-
242
-		switch vk {
243
-		case reflect.String:
244
-			fmt.Fprintf(buf, "%q", v.String())
245
-		case reflect.Bool:
246
-			fmt.Fprintf(buf, "%v", v.Bool())
247
-
248
-		case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
249
-			fmt.Fprintf(buf, "%d", v.Int())
250
-
251
-		case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
252
-			fmt.Fprintf(buf, "%d", v.Uint())
253
-
254
-		case reflect.Float32, reflect.Float64:
255
-			fmt.Fprintf(buf, "%g", v.Float())
256
-
257
-		case reflect.Complex64, reflect.Complex128:
258
-			fmt.Fprintf(buf, "%g", v.Complex())
259
-		}
260
-
261
-		if !implicit {
262
-			buf.WriteRune(')')
263
-		}
264
-	}
265
-}
266
-
267
-func writeType(buf *bytes.Buffer, ptrs int, t reflect.Type) {
268
-	parens := ptrs > 0
269
-	switch t.Kind() {
270
-	case reflect.Chan, reflect.Func, reflect.UnsafePointer:
271
-		parens = true
272
-	}
273
-
274
-	if parens {
275
-		buf.WriteRune('(')
276
-		for i := 0; i < ptrs; i++ {
277
-			buf.WriteRune('*')
278
-		}
279
-	}
280
-
281
-	switch t.Kind() {
282
-	case reflect.Ptr:
283
-		if ptrs == 0 {
284
-			// This pointer was referenced from within writeType (e.g., as part of
285
-			// rendering a list), and so hasn't had its pointer asterisk accounted
286
-			// for.
287
-			buf.WriteRune('*')
288
-		}
289
-		writeType(buf, 0, t.Elem())
290
-
291
-	case reflect.Interface:
292
-		if n := t.Name(); n != "" {
293
-			buf.WriteString(t.String())
294
-		} else {
295
-			buf.WriteString("interface{}")
296
-		}
297
-
298
-	case reflect.Array:
299
-		buf.WriteRune('[')
300
-		buf.WriteString(strconv.FormatInt(int64(t.Len()), 10))
301
-		buf.WriteRune(']')
302
-		writeType(buf, 0, t.Elem())
303
-
304
-	case reflect.Slice:
305
-		if t == reflect.SliceOf(t.Elem()) {
306
-			buf.WriteString("[]")
307
-			writeType(buf, 0, t.Elem())
308
-		} else {
309
-			// Custom slice type, use type name.
310
-			buf.WriteString(t.String())
311
-		}
312
-
313
-	case reflect.Map:
314
-		if t == reflect.MapOf(t.Key(), t.Elem()) {
315
-			buf.WriteString("map[")
316
-			writeType(buf, 0, t.Key())
317
-			buf.WriteRune(']')
318
-			writeType(buf, 0, t.Elem())
319
-		} else {
320
-			// Custom map type, use type name.
321
-			buf.WriteString(t.String())
322
-		}
323
-
324
-	default:
325
-		buf.WriteString(t.String())
326
-	}
327
-
328
-	if parens {
329
-		buf.WriteRune(')')
330
-	}
331
-}
332
-
333
-type cmpFn func(a, b reflect.Value) int
334
-
335
-type sortableValueSlice struct {
336
-	cmp      cmpFn
337
-	elements []reflect.Value
338
-}
339
-
340
-func (s sortableValueSlice) Len() int {
341
-	return len(s.elements)
342
-}
343
-
344
-func (s sortableValueSlice) Less(i, j int) bool {
345
-	return s.cmp(s.elements[i], s.elements[j]) < 0
346
-}
347
-
348
-func (s sortableValueSlice) Swap(i, j int) {
349
-	s.elements[i], s.elements[j] = s.elements[j], s.elements[i]
350
-}
351
-
352
-// cmpForType returns a cmpFn which sorts the data for some type t in the same
353
-// order that a go-native map key is compared for equality.
354
-func cmpForType(t reflect.Type) cmpFn {
355
-	switch t.Kind() {
356
-	case reflect.String:
357
-		return func(av, bv reflect.Value) int {
358
-			a, b := av.String(), bv.String()
359
-			if a < b {
360
-				return -1
361
-			} else if a > b {
362
-				return 1
363
-			}
364
-			return 0
365
-		}
366
-
367
-	case reflect.Bool:
368
-		return func(av, bv reflect.Value) int {
369
-			a, b := av.Bool(), bv.Bool()
370
-			if !a && b {
371
-				return -1
372
-			} else if a && !b {
373
-				return 1
374
-			}
375
-			return 0
376
-		}
377
-
378
-	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
379
-		return func(av, bv reflect.Value) int {
380
-			a, b := av.Int(), bv.Int()
381
-			if a < b {
382
-				return -1
383
-			} else if a > b {
384
-				return 1
385
-			}
386
-			return 0
387
-		}
388
-
389
-	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32,
390
-		reflect.Uint64, reflect.Uintptr, reflect.UnsafePointer:
391
-		return func(av, bv reflect.Value) int {
392
-			a, b := av.Uint(), bv.Uint()
393
-			if a < b {
394
-				return -1
395
-			} else if a > b {
396
-				return 1
397
-			}
398
-			return 0
399
-		}
400
-
401
-	case reflect.Float32, reflect.Float64:
402
-		return func(av, bv reflect.Value) int {
403
-			a, b := av.Float(), bv.Float()
404
-			if a < b {
405
-				return -1
406
-			} else if a > b {
407
-				return 1
408
-			}
409
-			return 0
410
-		}
411
-
412
-	case reflect.Interface:
413
-		return func(av, bv reflect.Value) int {
414
-			a, b := av.InterfaceData(), bv.InterfaceData()
415
-			if a[0] < b[0] {
416
-				return -1
417
-			} else if a[0] > b[0] {
418
-				return 1
419
-			}
420
-			if a[1] < b[1] {
421
-				return -1
422
-			} else if a[1] > b[1] {
423
-				return 1
424
-			}
425
-			return 0
426
-		}
427
-
428
-	case reflect.Complex64, reflect.Complex128:
429
-		return func(av, bv reflect.Value) int {
430
-			a, b := av.Complex(), bv.Complex()
431
-			if real(a) < real(b) {
432
-				return -1
433
-			} else if real(a) > real(b) {
434
-				return 1
435
-			}
436
-			if imag(a) < imag(b) {
437
-				return -1
438
-			} else if imag(a) > imag(b) {
439
-				return 1
440
-			}
441
-			return 0
442
-		}
443
-
444
-	case reflect.Ptr, reflect.Chan:
445
-		return func(av, bv reflect.Value) int {
446
-			a, b := av.Pointer(), bv.Pointer()
447
-			if a < b {
448
-				return -1
449
-			} else if a > b {
450
-				return 1
451
-			}
452
-			return 0
453
-		}
454
-
455
-	case reflect.Struct:
456
-		cmpLst := make([]cmpFn, t.NumField())
457
-		for i := range cmpLst {
458
-			cmpLst[i] = cmpForType(t.Field(i).Type)
459
-		}
460
-		return func(a, b reflect.Value) int {
461
-			for i, cmp := range cmpLst {
462
-				if rslt := cmp(a.Field(i), b.Field(i)); rslt != 0 {
463
-					return rslt
464
-				}
465
-			}
466
-			return 0
467
-		}
468
-	}
469
-
470
-	return nil
471
-}
472
-
473
-func tryAndSortMapKeys(mt reflect.Type, k []reflect.Value) {
474
-	if cmp := cmpForType(mt.Key()); cmp != nil {
475
-		sort.Sort(sortableValueSlice{cmp, k})
476
-	}
477
-}

+ 0 - 202
vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE

@@ -1,202 +0,0 @@
1
-
2
-                                 Apache License
3
-                           Version 2.0, January 2004
4
-                        http://www.apache.org/licenses/
5
-
6
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
-   1. Definitions.
9
-
10
-      "License" shall mean the terms and conditions for use, reproduction,
11
-      and distribution as defined by Sections 1 through 9 of this document.
12
-
13
-      "Licensor" shall mean the copyright owner or entity authorized by
14
-      the copyright owner that is granting the License.
15
-
16
-      "Legal Entity" shall mean the union of the acting entity and all
17
-      other entities that control, are controlled by, or are under common
18
-      control with that entity. For the purposes of this definition,
19
-      "control" means (i) the power, direct or indirect, to cause the
20
-      direction or management of such entity, whether by contract or
21
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
-      outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
-      "You" (or "Your") shall mean an individual or Legal Entity
25
-      exercising permissions granted by this License.
26
-
27
-      "Source" form shall mean the preferred form for making modifications,
28
-      including but not limited to software source code, documentation
29
-      source, and configuration files.
30
-
31
-      "Object" form shall mean any form resulting from mechanical
32
-      transformation or translation of a Source form, including but
33
-      not limited to compiled object code, generated documentation,
34
-      and conversions to other media types.
35
-
36
-      "Work" shall mean the work of authorship, whether in Source or
37
-      Object form, made available under the License, as indicated by a
38
-      copyright notice that is included in or attached to the work
39
-      (an example is provided in the Appendix below).
40
-
41
-      "Derivative Works" shall mean any work, whether in Source or Object
42
-      form, that is based on (or derived from) the Work and for which the
43
-      editorial revisions, annotations, elaborations, or other modifications
44
-      represent, as a whole, an original work of authorship. For the purposes
45
-      of this License, Derivative Works shall not include works that remain
46
-      separable from, or merely link (or bind by name) to the interfaces of,
47
-      the Work and Derivative Works thereof.
48
-
49
-      "Contribution" shall mean any work of authorship, including
50
-      the original version of the Work and any modifications or additions
51
-      to that Work or Derivative Works thereof, that is intentionally
52
-      submitted to Licensor for inclusion in the Work by the copyright owner
53
-      or by an individual or Legal Entity authorized to submit on behalf of
54
-      the copyright owner. For the purposes of this definition, "submitted"
55
-      means any form of electronic, verbal, or written communication sent
56
-      to the Licensor or its representatives, including but not limited to
57
-      communication on electronic mailing lists, source code control systems,
58
-      and issue tracking systems that are managed by, or on behalf of, the
59
-      Licensor for the purpose of discussing and improving the Work, but
60
-      excluding communication that is conspicuously marked or otherwise
61
-      designated in writing by the copyright owner as "Not a Contribution."
62
-
63
-      "Contributor" shall mean Licensor and any individual or Legal Entity
64
-      on behalf of whom a Contribution has been received by Licensor and
65
-      subsequently incorporated within the Work.
66
-
67
-   2. Grant of Copyright License. Subject to the terms and conditions of
68
-      this License, each Contributor hereby grants to You a perpetual,
69
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
-      copyright license to reproduce, prepare Derivative Works of,
71
-      publicly display, publicly perform, sublicense, and distribute the
72
-      Work and such Derivative Works in Source or Object form.
73
-
74
-   3. Grant of Patent License. Subject to the terms and conditions of
75
-      this License, each Contributor hereby grants to You a perpetual,
76
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
-      (except as stated in this section) patent license to make, have made,
78
-      use, offer to sell, sell, import, and otherwise transfer the Work,
79
-      where such license applies only to those patent claims licensable
80
-      by such Contributor that are necessarily infringed by their
81
-      Contribution(s) alone or by combination of their Contribution(s)
82
-      with the Work to which such Contribution(s) was submitted. If You
83
-      institute patent litigation against any entity (including a
84
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
85
-      or a Contribution incorporated within the Work constitutes direct
86
-      or contributory patent infringement, then any patent licenses
87
-      granted to You under this License for that Work shall terminate
88
-      as of the date such litigation is filed.
89
-
90
-   4. Redistribution. You may reproduce and distribute copies of the
91
-      Work or Derivative Works thereof in any medium, with or without
92
-      modifications, and in Source or Object form, provided that You
93
-      meet the following conditions:
94
-
95
-      (a) You must give any other recipients of the Work or
96
-          Derivative Works a copy of this License; and
97
-
98
-      (b) You must cause any modified files to carry prominent notices
99
-          stating that You changed the files; and
100
-
101
-      (c) You must retain, in the Source form of any Derivative Works
102
-          that You distribute, all copyright, patent, trademark, and
103
-          attribution notices from the Source form of the Work,
104
-          excluding those notices that do not pertain to any part of
105
-          the Derivative Works; and
106
-
107
-      (d) If the Work includes a "NOTICE" text file as part of its
108
-          distribution, then any Derivative Works that You distribute must
109
-          include a readable copy of the attribution notices contained
110
-          within such NOTICE file, excluding those notices that do not
111
-          pertain to any part of the Derivative Works, in at least one
112
-          of the following places: within a NOTICE text file distributed
113
-          as part of the Derivative Works; within the Source form or
114
-          documentation, if provided along with the Derivative Works; or,
115
-          within a display generated by the Derivative Works, if and
116
-          wherever such third-party notices normally appear. The contents
117
-          of the NOTICE file are for informational purposes only and
118
-          do not modify the License. You may add Your own attribution
119
-          notices within Derivative Works that You distribute, alongside
120
-          or as an addendum to the NOTICE text from the Work, provided
121
-          that such additional attribution notices cannot be construed
122
-          as modifying the License.
123
-
124
-      You may add Your own copyright statement to Your modifications and
125
-      may provide additional or different license terms and conditions
126
-      for use, reproduction, or distribution of Your modifications, or
127
-      for any such Derivative Works as a whole, provided Your use,
128
-      reproduction, and distribution of the Work otherwise complies with
129
-      the conditions stated in this License.
130
-
131
-   5. Submission of Contributions. Unless You explicitly state otherwise,
132
-      any Contribution intentionally submitted for inclusion in the Work
133
-      by You to the Licensor shall be under the terms and conditions of
134
-      this License, without any additional terms or conditions.
135
-      Notwithstanding the above, nothing herein shall supersede or modify
136
-      the terms of any separate license agreement you may have executed
137
-      with Licensor regarding such Contributions.
138
-
139
-   6. Trademarks. This License does not grant permission to use the trade
140
-      names, trademarks, service marks, or product names of the Licensor,
141
-      except as required for reasonable and customary use in describing the
142
-      origin of the Work and reproducing the content of the NOTICE file.
143
-
144
-   7. Disclaimer of Warranty. Unless required by applicable law or
145
-      agreed to in writing, Licensor provides the Work (and each
146
-      Contributor provides its Contributions) on an "AS IS" BASIS,
147
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
-      implied, including, without limitation, any warranties or conditions
149
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
-      PARTICULAR PURPOSE. You are solely responsible for determining the
151
-      appropriateness of using or redistributing the Work and assume any
152
-      risks associated with Your exercise of permissions under this License.
153
-
154
-   8. Limitation of Liability. In no event and under no legal theory,
155
-      whether in tort (including negligence), contract, or otherwise,
156
-      unless required by applicable law (such as deliberate and grossly
157
-      negligent acts) or agreed to in writing, shall any Contributor be
158
-      liable to You for damages, including any direct, indirect, special,
159
-      incidental, or consequential damages of any character arising as a
160
-      result of this License or out of the use or inability to use the
161
-      Work (including but not limited to damages for loss of goodwill,
162
-      work stoppage, computer failure or malfunction, or any and all
163
-      other commercial damages or losses), even if such Contributor
164
-      has been advised of the possibility of such damages.
165
-
166
-   9. Accepting Warranty or Additional Liability. While redistributing
167
-      the Work or Derivative Works thereof, You may choose to offer,
168
-      and charge a fee for, acceptance of support, warranty, indemnity,
169
-      or other liability obligations and/or rights consistent with this
170
-      License. However, in accepting such obligations, You may act only
171
-      on Your own behalf and on Your sole responsibility, not on behalf
172
-      of any other Contributor, and only if You agree to indemnify,
173
-      defend, and hold each Contributor harmless for any liability
174
-      incurred by, or claims asserted against, such Contributor by reason
175
-      of your accepting any such warranty or additional liability.
176
-
177
-   END OF TERMS AND CONDITIONS
178
-
179
-   APPENDIX: How to apply the Apache License to your work.
180
-
181
-      To apply the Apache License to your work, attach the following
182
-      boilerplate notice, with the fields enclosed by brackets "[]"
183
-      replaced with your own identifying information. (Don't include
184
-      the brackets!)  The text should be enclosed in the appropriate
185
-      comment syntax for the file format. We also recommend that a
186
-      file or class name and description of purpose be included on the
187
-      same "printed page" as the copyright notice for easier
188
-      identification within third-party archives.
189
-
190
-   Copyright [yyyy] [name of copyright owner]
191
-