aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/smartystreets
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/smartystreets')
-rw-r--r--vendor/github.com/smartystreets/assertions/CONTRIBUTING.md12
-rw-r--r--vendor/github.com/smartystreets/assertions/LICENSE.md23
-rwxr-xr-xvendor/github.com/smartystreets/assertions/Makefile11
-rw-r--r--vendor/github.com/smartystreets/assertions/README.md621
-rw-r--r--vendor/github.com/smartystreets/assertions/collections.go244
-rw-r--r--vendor/github.com/smartystreets/assertions/doc.go109
-rw-r--r--vendor/github.com/smartystreets/assertions/equal_method.go75
-rw-r--r--vendor/github.com/smartystreets/assertions/equality.go331
-rw-r--r--vendor/github.com/smartystreets/assertions/equality_diff.go37
-rw-r--r--vendor/github.com/smartystreets/assertions/filter.go31
-rw-r--r--vendor/github.com/smartystreets/assertions/go.mod3
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/LICENSE20
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diff.go1345
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go46
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/match.go160
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/mathutil.go23
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/operation_string.go17
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/patch.go556
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/stringutil.go88
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE27
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go481
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go26
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE202
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md58
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go94
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go61
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go88
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go541
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go39
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go39
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go41
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go152
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go86
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go53
-rw-r--r--vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go36
-rw-r--r--vendor/github.com/smartystreets/assertions/messages.go106
-rw-r--r--vendor/github.com/smartystreets/assertions/panic.go115
-rw-r--r--vendor/github.com/smartystreets/assertions/quantity.go141
-rw-r--r--vendor/github.com/smartystreets/assertions/serializer.go70
-rw-r--r--vendor/github.com/smartystreets/assertions/strings.go227
-rw-r--r--vendor/github.com/smartystreets/assertions/time.go218
-rw-r--r--vendor/github.com/smartystreets/assertions/type.go134
-rw-r--r--vendor/github.com/smartystreets/goconvey/CONTRIBUTING.md35
-rw-r--r--vendor/github.com/smartystreets/goconvey/LICENSE.md23
-rw-r--r--vendor/github.com/smartystreets/goconvey/README.md124
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/assertions.go71
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/context.go272
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/convey.goconvey4
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/discovery.go103
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/doc.go218
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go28
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/init.go81
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/nilReporter.go15
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/console.go16
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go5
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go40
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go33
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/init.go94
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/json.go88
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go60
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go80
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go39
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go179
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go108
-rw-r--r--vendor/github.com/smartystreets/goconvey/convey/reporting/story.go73
-rw-r--r--vendor/github.com/smartystreets/goconvey/dependencies.go4
-rw-r--r--vendor/github.com/smartystreets/goconvey/go.mod8
-rw-r--r--vendor/github.com/smartystreets/goconvey/go.sum12
-rw-r--r--vendor/github.com/smartystreets/goconvey/goconvey.go293
-rw-r--r--vendor/github.com/smartystreets/goconvey/goconvey_1_8.go42
-rw-r--r--vendor/github.com/smartystreets/goconvey/goconvey_1_9.go64
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/api/server.go164
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go27
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/contract/result.go100
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go12
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go71
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go84
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go56
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go56
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go178
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go32
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey2
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go45
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go177
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/parser/util.go49
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/system/shell.go174
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey3
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go171
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go82
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go183
-rw-r--r--vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey3
94 files changed, 0 insertions, 10674 deletions
diff --git a/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md b/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md
deleted file mode 100644
index 1820ecb3..00000000
--- a/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Contributing
-
-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.
-
-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:
-
-- _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.
-- _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.
-- _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.
-- _Style:_ Match your approach to **naming** and **formatting** with the surrounding code. Basically, the code you submit shouldn't stand out.
- - "Naming" refers to such constructs as variables, methods, functions, classes, structs, interfaces, packages, modules, directories, files, etc...
- - "Formatting" refers to such constructs as whitespace, horizontal line length, vertical function length, vertical file length, indentation, curly braces, etc...
diff --git a/vendor/github.com/smartystreets/assertions/LICENSE.md b/vendor/github.com/smartystreets/assertions/LICENSE.md
deleted file mode 100644
index 8ea6f945..00000000
--- a/vendor/github.com/smartystreets/assertions/LICENSE.md
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2016 SmartyStreets, LLC
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-NOTE: Various optional and subordinate components carry their own licensing
-requirements and restrictions. Use of those components is subject to the terms
-and conditions outlined the respective license of each component.
diff --git a/vendor/github.com/smartystreets/assertions/Makefile b/vendor/github.com/smartystreets/assertions/Makefile
deleted file mode 100755
index 7e90d4f2..00000000
--- a/vendor/github.com/smartystreets/assertions/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/make -f
-
-test:
- go test -timeout=1s -short ./...
-
-compile:
- go build ./...
-
-build: test compile
-
-.PHONY: test compile build
diff --git a/vendor/github.com/smartystreets/assertions/README.md b/vendor/github.com/smartystreets/assertions/README.md
deleted file mode 100644
index 6e2656c8..00000000
--- a/vendor/github.com/smartystreets/assertions/README.md
+++ /dev/null
@@ -1,621 +0,0 @@
-[![Build Status](https://travis-ci.org/smartystreets/assertions.svg?branch=master)](https://travis-ci.org/smartystreets/assertions)
-
-# assertions
---
- import "github.com/smartystreets/assertions"
-
-Package assertions contains the implementations for all assertions which are
-referenced in goconvey's `convey` package
-(github.com/smartystreets/goconvey/convey) and gunit
-(github.com/smartystreets/gunit) for use with the So(...) method. They can also
-be used in traditional Go test functions and even in applications.
-
-https://smartystreets.com
-
-Many of the assertions lean heavily on work done by Aaron Jacobs in his
-excellent oglematchers library. (https://github.com/jacobsa/oglematchers) The
-ShouldResemble assertion leans heavily on work done by Daniel Jacques in his
-very helpful go-render library. (https://github.com/luci/go-render)
-
-## Usage
-
-#### func GoConveyMode
-
-```go
-func GoConveyMode(yes bool)
-```
-GoConveyMode provides control over JSON serialization of failures. When using
-the assertions in this package from the convey package JSON results are very
-helpful and can be rendered in a DIFF view. In that case, this function will be
-called with a true value to enable the JSON serialization. By default, the
-assertions in this package will not serializer a JSON result, making standalone
-usage more convenient.
-
-#### func ShouldAlmostEqual
-
-```go
-func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string
-```
-ShouldAlmostEqual makes sure that two parameters are close enough to being
-equal. The acceptable delta may be specified with a third argument, or a very
-small default delta will be used.
-
-#### func ShouldBeBetween
-
-```go
-func ShouldBeBetween(actual interface{}, expected ...interface{}) string
-```
-ShouldBeBetween receives exactly three parameters: an actual value, a lower
-bound, and an upper bound. It ensures that the actual value is between both
-bounds (but not equal to either of them).
-
-#### func ShouldBeBetweenOrEqual
-
-```go
-func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
-```
-ShouldBeBetweenOrEqual receives exactly three parameters: an actual value, a
-lower bound, and an upper bound. It ensures that the actual value is between
-both bounds or equal to one of them.
-
-#### func ShouldBeBlank
-
-```go
-func ShouldBeBlank(actual interface{}, expected ...interface{}) string
-```
-ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal
-to "".
-
-#### func ShouldBeChronological
-
-```go
-func ShouldBeChronological(actual interface{}, expected ...interface{}) string
-```
-ShouldBeChronological receives a []time.Time slice and asserts that they are in
-chronological order starting with the first time.Time as the earliest.
-
-#### func ShouldBeEmpty
-
-```go
-func ShouldBeEmpty(actual interface{}, expected ...interface{}) string
-```
-ShouldBeEmpty receives a single parameter (actual) and determines whether or not
-calling len(actual) would return `0`. It obeys the rules specified by the len
-function for determining length: http://golang.org/pkg/builtin/#len
-
-#### func ShouldBeError
-
-```go
-func ShouldBeError(actual interface{}, expected ...interface{}) string
-```
-ShouldBeError asserts that the first argument implements the error interface. It
-also compares the first argument against the second argument if provided (which
-must be an error message string or another error value).
-
-#### func ShouldBeFalse
-
-```go
-func ShouldBeFalse(actual interface{}, expected ...interface{}) string
-```
-ShouldBeFalse receives a single parameter and ensures that it is false.
-
-#### func ShouldBeGreaterThan
-
-```go
-func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string
-```
-ShouldBeGreaterThan receives exactly two parameters and ensures that the first
-is greater than the second.
-
-#### func ShouldBeGreaterThanOrEqualTo
-
-```go
-func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string
-```
-ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that
-the first is greater than or equal to the second.
-
-#### func ShouldBeIn
-
-```go
-func ShouldBeIn(actual interface{}, expected ...interface{}) string
-```
-ShouldBeIn receives at least 2 parameters. The first is a proposed member of the
-collection that is passed in either as the second parameter, or of the
-collection that is comprised of all the remaining parameters. This assertion
-ensures that the proposed member is in the collection (using ShouldEqual).
-
-#### func ShouldBeLessThan
-
-```go
-func ShouldBeLessThan(actual interface{}, expected ...interface{}) string
-```
-ShouldBeLessThan receives exactly two parameters and ensures that the first is
-less than the second.
-
-#### func ShouldBeLessThanOrEqualTo
-
-```go
-func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string
-```
-ShouldBeLessThan receives exactly two parameters and ensures that the first is
-less than or equal to the second.
-
-#### func ShouldBeNil
-
-```go
-func ShouldBeNil(actual interface{}, expected ...interface{}) string
-```
-ShouldBeNil receives a single parameter and ensures that it is nil.
-
-#### func ShouldBeTrue
-
-```go
-func ShouldBeTrue(actual interface{}, expected ...interface{}) string
-```
-ShouldBeTrue receives a single parameter and ensures that it is true.
-
-#### func ShouldBeZeroValue
-
-```go
-func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string
-```
-ShouldBeZeroValue receives a single parameter and ensures that it is the Go
-equivalent of the default value, or "zero" value.
-
-#### func ShouldContain
-
-```go
-func ShouldContain(actual interface{}, expected ...interface{}) string
-```
-ShouldContain receives exactly two parameters. The first is a slice and the
-second is a proposed member. Membership is determined using ShouldEqual.
-
-#### func ShouldContainKey
-
-```go
-func ShouldContainKey(actual interface{}, expected ...interface{}) string
-```
-ShouldContainKey receives exactly two parameters. The first is a map and the
-second is a proposed key. Keys are compared with a simple '=='.
-
-#### func ShouldContainSubstring
-
-```go
-func ShouldContainSubstring(actual interface{}, expected ...interface{}) string
-```
-ShouldContainSubstring receives exactly 2 string parameters and ensures that the
-first contains the second as a substring.
-
-#### func ShouldEndWith
-
-```go
-func ShouldEndWith(actual interface{}, expected ...interface{}) string
-```
-ShouldEndWith receives exactly 2 string parameters and ensures that the first
-ends with the second.
-
-#### func ShouldEqual
-
-```go
-func ShouldEqual(actual interface{}, expected ...interface{}) string
-```
-ShouldEqual receives exactly two parameters and does an equality check using the
-following semantics: 1. If the expected and actual values implement an Equal
-method in the form `func (this T) Equal(that T) bool` then call the method. If
-true, they are equal. 2. The expected and actual values are judged equal or not
-by oglematchers.Equals.
-
-#### func ShouldEqualJSON
-
-```go
-func ShouldEqualJSON(actual interface{}, expected ...interface{}) string
-```
-ShouldEqualJSON receives exactly two parameters and does an equality check by
-marshalling to JSON
-
-#### func ShouldEqualTrimSpace
-
-```go
-func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) string
-```
-ShouldEqualTrimSpace receives exactly 2 string parameters and ensures that the
-first is equal to the second after removing all leading and trailing whitespace
-using strings.TrimSpace(first).
-
-#### func ShouldEqualWithout
-
-```go
-func ShouldEqualWithout(actual interface{}, expected ...interface{}) string
-```
-ShouldEqualWithout receives exactly 3 string parameters and ensures that the
-first is equal to the second after removing all instances of the third from the
-first using strings.Replace(first, third, "", -1).
-
-#### func ShouldHappenAfter
-
-```go
-func ShouldHappenAfter(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the
-first happens after the second.
-
-#### func ShouldHappenBefore
-
-```go
-func ShouldHappenBefore(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the
-first happens before the second.
-
-#### func ShouldHappenBetween
-
-```go
-func ShouldHappenBetween(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the
-first happens between (not on) the second and third.
-
-#### func ShouldHappenOnOrAfter
-
-```go
-func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that
-the first happens on or after the second.
-
-#### func ShouldHappenOnOrBefore
-
-```go
-func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that
-the first happens on or before the second.
-
-#### func ShouldHappenOnOrBetween
-
-```go
-func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that
-the first happens between or on the second and third.
-
-#### func ShouldHappenWithin
-
-```go
-func ShouldHappenWithin(actual interface{}, expected ...interface{}) string
-```
-ShouldHappenWithin receives a time.Time, a time.Duration, and a time.Time (3
-arguments) and asserts that the first time.Time happens within or on the
-duration specified relative to the other time.Time.
-
-#### func ShouldHaveLength
-
-```go
-func ShouldHaveLength(actual interface{}, expected ...interface{}) string
-```
-ShouldHaveLength receives 2 parameters. The first is a collection to check the
-length of, the second being the expected length. It obeys the rules specified by
-the len function for determining length: http://golang.org/pkg/builtin/#len
-
-#### func ShouldHaveSameTypeAs
-
-```go
-func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string
-```
-ShouldHaveSameTypeAs receives exactly two parameters and compares their
-underlying types for equality.
-
-#### func ShouldImplement
-
-```go
-func ShouldImplement(actual interface{}, expectedList ...interface{}) string
-```
-ShouldImplement receives exactly two parameters and ensures that the first
-implements the interface type of the second.
-
-#### func ShouldNotAlmostEqual
-
-```go
-func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string
-```
-ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual
-
-#### func ShouldNotBeBetween
-
-```go
-func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeBetween receives exactly three parameters: an actual value, a lower
-bound, and an upper bound. It ensures that the actual value is NOT between both
-bounds.
-
-#### func ShouldNotBeBetweenOrEqual
-
-```go
-func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeBetweenOrEqual receives exactly three parameters: an actual value, a
-lower bound, and an upper bound. It ensures that the actual value is nopt
-between the bounds nor equal to either of them.
-
-#### func ShouldNotBeBlank
-
-```go
-func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is
-equal to "".
-
-#### func ShouldNotBeChronological
-
-```go
-func ShouldNotBeChronological(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeChronological receives a []time.Time slice and asserts that they are
-NOT in chronological order.
-
-#### func ShouldNotBeEmpty
-
-```go
-func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeEmpty receives a single parameter (actual) and determines whether or
-not calling len(actual) would return a value greater than zero. It obeys the
-rules specified by the `len` function for determining length:
-http://golang.org/pkg/builtin/#len
-
-#### func ShouldNotBeIn
-
-```go
-func ShouldNotBeIn(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of
-the collection that is passed in either as the second parameter, or of the
-collection that is comprised of all the remaining parameters. This assertion
-ensures that the proposed member is NOT in the collection (using ShouldEqual).
-
-#### func ShouldNotBeNil
-
-```go
-func ShouldNotBeNil(actual interface{}, expected ...interface{}) string
-```
-ShouldNotBeNil receives a single parameter and ensures that it is not nil.
-
-#### func ShouldNotBeZeroValue
-
-```go
-func ShouldNotBeZeroValue(actual interface{}, expected ...interface{}) string
-```
-ShouldBeZeroValue receives a single parameter and ensures that it is NOT the Go
-equivalent of the default value, or "zero" value.
-
-#### func ShouldNotContain
-
-```go
-func ShouldNotContain(actual interface{}, expected ...interface{}) string
-```
-ShouldNotContain receives exactly two parameters. The first is a slice and the
-second is a proposed member. Membership is determinied using ShouldEqual.
-
-#### func ShouldNotContainKey
-
-```go
-func ShouldNotContainKey(actual interface{}, expected ...interface{}) string
-```
-ShouldNotContainKey receives exactly two parameters. The first is a map and the
-second is a proposed absent key. Keys are compared with a simple '=='.
-
-#### func ShouldNotContainSubstring
-
-```go
-func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string
-```
-ShouldNotContainSubstring receives exactly 2 string parameters and ensures that
-the first does NOT contain the second as a substring.
-
-#### func ShouldNotEndWith
-
-```go
-func ShouldNotEndWith(actual interface{}, expected ...interface{}) string
-```
-ShouldEndWith receives exactly 2 string parameters and ensures that the first
-does not end with the second.
-
-#### func ShouldNotEqual
-
-```go
-func ShouldNotEqual(actual interface{}, expected ...interface{}) string
-```
-ShouldNotEqual receives exactly two parameters and does an inequality check. See
-ShouldEqual for details on how equality is determined.
-
-#### func ShouldNotHappenOnOrBetween
-
-```go
-func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string
-```
-ShouldNotHappenOnOrBetween receives exactly 3 time.Time arguments and asserts
-that the first does NOT happen between or on the second or third.
-
-#### func ShouldNotHappenWithin
-
-```go
-func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string
-```
-ShouldNotHappenWithin receives a time.Time, a time.Duration, and a time.Time (3
-arguments) and asserts that the first time.Time does NOT happen within or on the
-duration specified relative to the other time.Time.
-
-#### func ShouldNotHaveSameTypeAs
-
-```go
-func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string
-```
-ShouldNotHaveSameTypeAs receives exactly two parameters and compares their
-underlying types for inequality.
-
-#### func ShouldNotImplement
-
-```go
-func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string
-```
-ShouldNotImplement receives exactly two parameters and ensures that the first
-does NOT implement the interface type of the second.
-
-#### func ShouldNotPanic
-
-```go
-func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string)
-```
-ShouldNotPanic receives a void, niladic function and expects to execute the
-function without any panic.
-
-#### func ShouldNotPanicWith
-
-```go
-func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string)
-```
-ShouldNotPanicWith receives a void, niladic function and expects to recover a
-panic whose content differs from the second argument.
-
-#### func ShouldNotPointTo
-
-```go
-func ShouldNotPointTo(actual interface{}, expected ...interface{}) string
-```
-ShouldNotPointTo receives exactly two parameters and checks to see that they
-point to different addresess.
-
-#### func ShouldNotResemble
-
-```go
-func ShouldNotResemble(actual interface{}, expected ...interface{}) string
-```
-ShouldNotResemble receives exactly two parameters and does an inverse deep equal
-check (see reflect.DeepEqual)
-
-#### func ShouldNotStartWith
-
-```go
-func ShouldNotStartWith(actual interface{}, expected ...interface{}) string
-```
-ShouldNotStartWith receives exactly 2 string parameters and ensures that the
-first does not start with the second.
-
-#### func ShouldPanic
-
-```go
-func ShouldPanic(actual interface{}, expected ...interface{}) (message string)
-```
-ShouldPanic receives a void, niladic function and expects to recover a panic.
-
-#### func ShouldPanicWith
-
-```go
-func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string)
-```
-ShouldPanicWith receives a void, niladic function and expects to recover a panic
-with the second argument as the content.
-
-#### func ShouldPointTo
-
-```go
-func ShouldPointTo(actual interface{}, expected ...interface{}) string
-```
-ShouldPointTo receives exactly two parameters and checks to see that they point
-to the same address.
-
-#### func ShouldResemble
-
-```go
-func ShouldResemble(actual interface{}, expected ...interface{}) string
-```
-ShouldResemble receives exactly two parameters and does a deep equal check (see
-reflect.DeepEqual)
-
-#### func ShouldStartWith
-
-```go
-func ShouldStartWith(actual interface{}, expected ...interface{}) string
-```
-ShouldStartWith receives exactly 2 string parameters and ensures that the first
-starts with the second.
-
-#### func So
-
-```go
-func So(actual interface{}, assert assertion, expected ...interface{}) (bool, string)
-```
-So is a convenience function (as opposed to an inconvenience function?) for
-running assertions on arbitrary arguments in any context, be it for testing or
-even application logging. It allows you to perform assertion-like behavior (and
-get nicely formatted messages detailing discrepancies) but without the program
-blowing up or panicking. All that is required is to import this package and call
-`So` with one of the assertions exported by this package as the second
-parameter. The first return parameter is a boolean indicating if the assertion
-was true. The second return parameter is the well-formatted message showing why
-an assertion was incorrect, or blank if the assertion was correct.
-
-Example:
-
- if ok, message := So(x, ShouldBeGreaterThan, y); !ok {
- log.Println(message)
- }
-
-For an alternative implementation of So (that provides more flexible return
-options) see the `So` function in the package at
-github.com/smartystreets/assertions/assert.
-
-#### type Assertion
-
-```go
-type Assertion struct {
-}
-```
-
-
-#### func New
-
-```go
-func New(t testingT) *Assertion
-```
-New swallows the *testing.T struct and prints failed assertions using t.Error.
-Example: assertions.New(t).So(1, should.Equal, 1)
-
-#### func (*Assertion) Failed
-
-```go
-func (this *Assertion) Failed() bool
-```
-Failed reports whether any calls to So (on this Assertion instance) have failed.
-
-#### func (*Assertion) So
-
-```go
-func (this *Assertion) So(actual interface{}, assert assertion, expected ...interface{}) bool
-```
-So calls the standalone So function and additionally, calls t.Error in failure
-scenarios.
-
-#### type FailureView
-
-```go
-type FailureView struct {
- Message string `json:"Message"`
- Expected string `json:"Expected"`
- Actual string `json:"Actual"`
-}
-```
-
-This struct is also declared in
-github.com/smartystreets/goconvey/convey/reporting. The json struct tags should
-be equal in both declarations.
-
-#### type Serializer
-
-```go
-type Serializer interface {
- // contains filtered or unexported methods
-}
-```
diff --git a/vendor/github.com/smartystreets/assertions/collections.go b/vendor/github.com/smartystreets/assertions/collections.go
deleted file mode 100644
index b534d4ba..00000000
--- a/vendor/github.com/smartystreets/assertions/collections.go
+++ /dev/null
@@ -1,244 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "reflect"
-
- "github.com/smartystreets/assertions/internal/oglematchers"
-)
-
-// ShouldContain receives exactly two parameters. The first is a slice and the
-// second is a proposed member. Membership is determined using ShouldEqual.
-func ShouldContain(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- if matchError := oglematchers.Contains(expected[0]).Matches(actual); matchError != nil {
- typeName := reflect.TypeOf(actual)
-
- if fmt.Sprintf("%v", matchError) == "which is not a slice or array" {
- return fmt.Sprintf(shouldHaveBeenAValidCollection, typeName)
- }
- return fmt.Sprintf(shouldHaveContained, typeName, expected[0])
- }
- return success
-}
-
-// ShouldNotContain receives exactly two parameters. The first is a slice and the
-// second is a proposed member. Membership is determinied using ShouldEqual.
-func ShouldNotContain(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
- typeName := reflect.TypeOf(actual)
-
- if matchError := oglematchers.Contains(expected[0]).Matches(actual); matchError != nil {
- if fmt.Sprintf("%v", matchError) == "which is not a slice or array" {
- return fmt.Sprintf(shouldHaveBeenAValidCollection, typeName)
- }
- return success
- }
- return fmt.Sprintf(shouldNotHaveContained, typeName, expected[0])
-}
-
-// ShouldContainKey receives exactly two parameters. The first is a map and the
-// second is a proposed key. Keys are compared with a simple '=='.
-func ShouldContainKey(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- keys, isMap := mapKeys(actual)
- if !isMap {
- return fmt.Sprintf(shouldHaveBeenAValidMap, reflect.TypeOf(actual))
- }
-
- if !keyFound(keys, expected[0]) {
- return fmt.Sprintf(shouldHaveContainedKey, reflect.TypeOf(actual), expected)
- }
-
- return ""
-}
-
-// ShouldNotContainKey receives exactly two parameters. The first is a map and the
-// second is a proposed absent key. Keys are compared with a simple '=='.
-func ShouldNotContainKey(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- keys, isMap := mapKeys(actual)
- if !isMap {
- return fmt.Sprintf(shouldHaveBeenAValidMap, reflect.TypeOf(actual))
- }
-
- if keyFound(keys, expected[0]) {
- return fmt.Sprintf(shouldNotHaveContainedKey, reflect.TypeOf(actual), expected)
- }
-
- return ""
-}
-
-func mapKeys(m interface{}) ([]reflect.Value, bool) {
- value := reflect.ValueOf(m)
- if value.Kind() != reflect.Map {
- return nil, false
- }
- return value.MapKeys(), true
-}
-func keyFound(keys []reflect.Value, expectedKey interface{}) bool {
- found := false
- for _, key := range keys {
- if key.Interface() == expectedKey {
- found = true
- }
- }
- return found
-}
-
-// ShouldBeIn receives at least 2 parameters. The first is a proposed member of the collection
-// that is passed in either as the second parameter, or of the collection that is comprised
-// of all the remaining parameters. This assertion ensures that the proposed member is in
-// the collection (using ShouldEqual).
-func ShouldBeIn(actual interface{}, expected ...interface{}) string {
- if fail := atLeast(1, expected); fail != success {
- return fail
- }
-
- if len(expected) == 1 {
- return shouldBeIn(actual, expected[0])
- }
- return shouldBeIn(actual, expected)
-}
-func shouldBeIn(actual interface{}, expected interface{}) string {
- if matchError := oglematchers.Contains(actual).Matches(expected); matchError != nil {
- return fmt.Sprintf(shouldHaveBeenIn, actual, reflect.TypeOf(expected))
- }
- return success
-}
-
-// ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of the collection
-// that is passed in either as the second parameter, or of the collection that is comprised
-// of all the remaining parameters. This assertion ensures that the proposed member is NOT in
-// the collection (using ShouldEqual).
-func ShouldNotBeIn(actual interface{}, expected ...interface{}) string {
- if fail := atLeast(1, expected); fail != success {
- return fail
- }
-
- if len(expected) == 1 {
- return shouldNotBeIn(actual, expected[0])
- }
- return shouldNotBeIn(actual, expected)
-}
-func shouldNotBeIn(actual interface{}, expected interface{}) string {
- if matchError := oglematchers.Contains(actual).Matches(expected); matchError == nil {
- return fmt.Sprintf(shouldNotHaveBeenIn, actual, reflect.TypeOf(expected))
- }
- return success
-}
-
-// ShouldBeEmpty receives a single parameter (actual) and determines whether or not
-// calling len(actual) would return `0`. It obeys the rules specified by the len
-// function for determining length: http://golang.org/pkg/builtin/#len
-func ShouldBeEmpty(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
-
- if actual == nil {
- return success
- }
-
- value := reflect.ValueOf(actual)
- switch value.Kind() {
- case reflect.Slice:
- if value.Len() == 0 {
- return success
- }
- case reflect.Chan:
- if value.Len() == 0 {
- return success
- }
- case reflect.Map:
- if value.Len() == 0 {
- return success
- }
- case reflect.String:
- if value.Len() == 0 {
- return success
- }
- case reflect.Ptr:
- elem := value.Elem()
- kind := elem.Kind()
- if (kind == reflect.Slice || kind == reflect.Array) && elem.Len() == 0 {
- return success
- }
- }
-
- return fmt.Sprintf(shouldHaveBeenEmpty, actual)
-}
-
-// ShouldNotBeEmpty receives a single parameter (actual) and determines whether or not
-// calling len(actual) would return a value greater than zero. It obeys the rules
-// specified by the `len` function for determining length: http://golang.org/pkg/builtin/#len
-func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
-
- if empty := ShouldBeEmpty(actual, expected...); empty != success {
- return success
- }
- return fmt.Sprintf(shouldNotHaveBeenEmpty, actual)
-}
-
-// ShouldHaveLength receives 2 parameters. The first is a collection to check
-// the length of, the second being the expected length. It obeys the rules
-// specified by the len function for determining length:
-// http://golang.org/pkg/builtin/#len
-func ShouldHaveLength(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- var expectedLen int64
- lenValue := reflect.ValueOf(expected[0])
- switch lenValue.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- expectedLen = lenValue.Int()
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- expectedLen = int64(lenValue.Uint())
- default:
- return fmt.Sprintf(shouldHaveBeenAValidInteger, reflect.TypeOf(expected[0]))
- }
-
- if expectedLen < 0 {
- return fmt.Sprintf(shouldHaveBeenAValidLength, expected[0])
- }
-
- value := reflect.ValueOf(actual)
- switch value.Kind() {
- case reflect.Slice,
- reflect.Chan,
- reflect.Map,
- reflect.String:
- if int64(value.Len()) == expectedLen {
- return success
- } else {
- return fmt.Sprintf(shouldHaveHadLength, expectedLen, value.Len(), actual)
- }
- case reflect.Ptr:
- elem := value.Elem()
- kind := elem.Kind()
- if kind == reflect.Slice || kind == reflect.Array {
- if int64(elem.Len()) == expectedLen {
- return success
- } else {
- return fmt.Sprintf(shouldHaveHadLength, expectedLen, elem.Len(), actual)
- }
- }
- }
- return fmt.Sprintf(shouldHaveBeenAValidCollection, reflect.TypeOf(actual))
-}
diff --git a/vendor/github.com/smartystreets/assertions/doc.go b/vendor/github.com/smartystreets/assertions/doc.go
deleted file mode 100644
index ba30a926..00000000
--- a/vendor/github.com/smartystreets/assertions/doc.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Package assertions contains the implementations for all assertions which
-// are referenced in goconvey's `convey` package
-// (github.com/smartystreets/goconvey/convey) and gunit (github.com/smartystreets/gunit)
-// for use with the So(...) method.
-// They can also be used in traditional Go test functions and even in
-// applications.
-//
-// https://smartystreets.com
-//
-// Many of the assertions lean heavily on work done by Aaron Jacobs in his excellent oglematchers library.
-// (https://github.com/jacobsa/oglematchers)
-// The ShouldResemble assertion leans heavily on work done by Daniel Jacques in his very helpful go-render library.
-// (https://github.com/luci/go-render)
-package assertions
-
-import (
- "fmt"
- "runtime"
-)
-
-// By default we use a no-op serializer. The actual Serializer provides a JSON
-// representation of failure results on selected assertions so the goconvey
-// web UI can display a convenient diff.
-var serializer Serializer = new(noopSerializer)
-
-// GoConveyMode provides control over JSON serialization of failures. When
-// using the assertions in this package from the convey package JSON results
-// are very helpful and can be rendered in a DIFF view. In that case, this function
-// will be called with a true value to enable the JSON serialization. By default,
-// the assertions in this package will not serializer a JSON result, making
-// standalone usage more convenient.
-func GoConveyMode(yes bool) {
- if yes {
- serializer = newSerializer()
- } else {
- serializer = new(noopSerializer)
- }
-}
-
-type testingT interface {
- Error(args ...interface{})
-}
-
-type Assertion struct {
- t testingT
- failed bool
-}
-
-// New swallows the *testing.T struct and prints failed assertions using t.Error.
-// Example: assertions.New(t).So(1, should.Equal, 1)
-func New(t testingT) *Assertion {
- return &Assertion{t: t}
-}
-
-// Failed reports whether any calls to So (on this Assertion instance) have failed.
-func (this *Assertion) Failed() bool {
- return this.failed
-}
-
-// So calls the standalone So function and additionally, calls t.Error in failure scenarios.
-func (this *Assertion) So(actual interface{}, assert assertion, expected ...interface{}) bool {
- ok, result := So(actual, assert, expected...)
- if !ok {
- this.failed = true
- _, file, line, _ := runtime.Caller(1)
- this.t.Error(fmt.Sprintf("\n%s:%d\n%s", file, line, result))
- }
- return ok
-}
-
-// So is a convenience function (as opposed to an inconvenience function?)
-// for running assertions on arbitrary arguments in any context, be it for testing or even
-// application logging. It allows you to perform assertion-like behavior (and get nicely
-// formatted messages detailing discrepancies) but without the program blowing up or panicking.
-// All that is required is to import this package and call `So` with one of the assertions
-// exported by this package as the second parameter.
-// The first return parameter is a boolean indicating if the assertion was true. The second
-// return parameter is the well-formatted message showing why an assertion was incorrect, or
-// blank if the assertion was correct.
-//
-// Example:
-//
-// if ok, message := So(x, ShouldBeGreaterThan, y); !ok {
-// log.Println(message)
-// }
-//
-// For an alternative implementation of So (that provides more flexible return options)
-// see the `So` function in the package at github.com/smartystreets/assertions/assert.
-func So(actual interface{}, assert assertion, expected ...interface{}) (bool, string) {
- if result := so(actual, assert, expected...); len(result) == 0 {
- return true, result
- } else {
- return false, result
- }
-}
-
-// so is like So, except that it only returns the string message, which is blank if the
-// assertion passed. Used to facilitate testing.
-func so(actual interface{}, assert func(interface{}, ...interface{}) string, expected ...interface{}) string {
- return assert(actual, expected...)
-}
-
-// assertion is an alias for a function with a signature that the So()
-// function can handle. Any future or custom assertions should conform to this
-// method signature. The return value should be an empty string if the assertion
-// passes and a well-formed failure message if not.
-type assertion func(actual interface{}, expected ...interface{}) string
-
-////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/assertions/equal_method.go b/vendor/github.com/smartystreets/assertions/equal_method.go
deleted file mode 100644
index c4fc38fa..00000000
--- a/vendor/github.com/smartystreets/assertions/equal_method.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package assertions
-
-import "reflect"
-
-type equalityMethodSpecification struct {
- a interface{}
- b interface{}
-
- aType reflect.Type
- bType reflect.Type
-
- equalMethod reflect.Value
-}
-
-func newEqualityMethodSpecification(a, b interface{}) *equalityMethodSpecification {
- return &equalityMethodSpecification{
- a: a,
- b: b,
- }
-}
-
-func (this *equalityMethodSpecification) IsSatisfied() bool {
- if !this.bothAreSameType() {
- return false
- }
- if !this.typeHasEqualMethod() {
- return false
- }
- if !this.equalMethodReceivesSameTypeForComparison() {
- return false
- }
- if !this.equalMethodReturnsBool() {
- return false
- }
- return true
-}
-
-func (this *equalityMethodSpecification) bothAreSameType() bool {
- this.aType = reflect.TypeOf(this.a)
- if this.aType == nil {
- return false
- }
- if this.aType.Kind() == reflect.Ptr {
- this.aType = this.aType.Elem()
- }
- this.bType = reflect.TypeOf(this.b)
- return this.aType == this.bType
-}
-func (this *equalityMethodSpecification) typeHasEqualMethod() bool {
- aInstance := reflect.ValueOf(this.a)
- this.equalMethod = aInstance.MethodByName("Equal")
- return this.equalMethod != reflect.Value{}
-}
-
-func (this *equalityMethodSpecification) equalMethodReceivesSameTypeForComparison() bool {
- signature := this.equalMethod.Type()
- return signature.NumIn() == 1 && signature.In(0) == this.aType
-}
-
-func (this *equalityMethodSpecification) equalMethodReturnsBool() bool {
- signature := this.equalMethod.Type()
- return signature.NumOut() == 1 && signature.Out(0) == reflect.TypeOf(true)
-}
-
-func (this *equalityMethodSpecification) AreEqual() bool {
- a := reflect.ValueOf(this.a)
- b := reflect.ValueOf(this.b)
- return areEqual(a, b) && areEqual(b, a)
-}
-func areEqual(receiver reflect.Value, argument reflect.Value) bool {
- equalMethod := receiver.MethodByName("Equal")
- argumentList := []reflect.Value{argument}
- result := equalMethod.Call(argumentList)
- return result[0].Bool()
-}
diff --git a/vendor/github.com/smartystreets/assertions/equality.go b/vendor/github.com/smartystreets/assertions/equality.go
deleted file mode 100644
index 37a49f4e..00000000
--- a/vendor/github.com/smartystreets/assertions/equality.go
+++ /dev/null
@@ -1,331 +0,0 @@
-package assertions
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "math"
- "reflect"
- "strings"
-
- "github.com/smartystreets/assertions/internal/go-render/render"
- "github.com/smartystreets/assertions/internal/oglematchers"
-)
-
-// ShouldEqual receives exactly two parameters and does an equality check
-// using the following semantics:
-// 1. If the expected and actual values implement an Equal method in the form
-// `func (this T) Equal(that T) bool` then call the method. If true, they are equal.
-// 2. The expected and actual values are judged equal or not by oglematchers.Equals.
-func ShouldEqual(actual interface{}, expected ...interface{}) string {
- if message := need(1, expected); message != success {
- return message
- }
- return shouldEqual(actual, expected[0])
-}
-func shouldEqual(actual, expected interface{}) (message string) {
- defer func() {
- if r := recover(); r != nil {
- message = serializer.serialize(expected, actual, composeEqualityMismatchMessage(expected, actual))
- }
- }()
-
- if spec := newEqualityMethodSpecification(expected, actual); spec.IsSatisfied() && spec.AreEqual() {
- return success
- } else if matchError := oglematchers.Equals(expected).Matches(actual); matchError == nil {
- return success
- }
-
- return serializer.serialize(expected, actual, composeEqualityMismatchMessage(expected, actual))
-}
-func composeEqualityMismatchMessage(expected, actual interface{}) string {
- var (
- renderedExpected = fmt.Sprintf("%v", expected)
- renderedActual = fmt.Sprintf("%v", actual)
- )
-
- if renderedExpected != renderedActual {
- return fmt.Sprintf(shouldHaveBeenEqual+composePrettyDiff(renderedExpected, renderedActual), expected, actual)
- } else if reflect.TypeOf(expected) != reflect.TypeOf(actual) {
- return fmt.Sprintf(shouldHaveBeenEqualTypeMismatch, expected, expected, actual, actual)
- } else {
- return fmt.Sprintf(shouldHaveBeenEqualNoResemblance, renderedExpected)
- }
-}
-
-// ShouldNotEqual receives exactly two parameters and does an inequality check.
-// See ShouldEqual for details on how equality is determined.
-func ShouldNotEqual(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- } else if ShouldEqual(actual, expected[0]) == success {
- return fmt.Sprintf(shouldNotHaveBeenEqual, actual, expected[0])
- }
- return success
-}
-
-// ShouldAlmostEqual makes sure that two parameters are close enough to being equal.
-// The acceptable delta may be specified with a third argument,
-// or a very small default delta will be used.
-func ShouldAlmostEqual(actual interface{}, expected ...interface{}) string {
- actualFloat, expectedFloat, deltaFloat, err := cleanAlmostEqualInput(actual, expected...)
-
- if err != "" {
- return err
- }
-
- if math.Abs(actualFloat-expectedFloat) <= deltaFloat {
- return success
- } else {
- return fmt.Sprintf(shouldHaveBeenAlmostEqual, actualFloat, expectedFloat)
- }
-}
-
-// ShouldNotAlmostEqual is the inverse of ShouldAlmostEqual
-func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) string {
- actualFloat, expectedFloat, deltaFloat, err := cleanAlmostEqualInput(actual, expected...)
-
- if err != "" {
- return err
- }
-
- if math.Abs(actualFloat-expectedFloat) > deltaFloat {
- return success
- } else {
- return fmt.Sprintf(shouldHaveNotBeenAlmostEqual, actualFloat, expectedFloat)
- }
-}
-
-func cleanAlmostEqualInput(actual interface{}, expected ...interface{}) (float64, float64, float64, string) {
- deltaFloat := 0.0000000001
-
- if len(expected) == 0 {
- return 0.0, 0.0, 0.0, "This assertion requires exactly one comparison value and an optional delta (you provided neither)"
- } else if len(expected) == 2 {
- delta, err := getFloat(expected[1])
-
- if err != nil {
- return 0.0, 0.0, 0.0, "The delta value " + err.Error()
- }
-
- deltaFloat = delta
- } else if len(expected) > 2 {
- return 0.0, 0.0, 0.0, "This assertion requires exactly one comparison value and an optional delta (you provided more values)"
- }
-
- actualFloat, err := getFloat(actual)
- if err != nil {
- return 0.0, 0.0, 0.0, "The actual value " + err.Error()
- }
-
- expectedFloat, err := getFloat(expected[0])
- if err != nil {
- return 0.0, 0.0, 0.0, "The comparison value " + err.Error()
- }
-
- return actualFloat, expectedFloat, deltaFloat, ""
-}
-
-// returns the float value of any real number, or error if it is not a numerical type
-func getFloat(num interface{}) (float64, error) {
- numValue := reflect.ValueOf(num)
- numKind := numValue.Kind()
-
- if numKind == reflect.Int ||
- numKind == reflect.Int8 ||
- numKind == reflect.Int16 ||
- numKind == reflect.Int32 ||
- numKind == reflect.Int64 {
- return float64(numValue.Int()), nil
- } else if numKind == reflect.Uint ||
- numKind == reflect.Uint8 ||
- numKind == reflect.Uint16 ||
- numKind == reflect.Uint32 ||
- numKind == reflect.Uint64 {
- return float64(numValue.Uint()), nil
- } else if numKind == reflect.Float32 ||
- numKind == reflect.Float64 {
- return numValue.Float(), nil
- } else {
- return 0.0, errors.New("must be a numerical type, but was: " + numKind.String())
- }
-}
-
-// ShouldEqualJSON receives exactly two parameters and does an equality check by marshalling to JSON
-func ShouldEqualJSON(actual interface{}, expected ...interface{}) string {
- if message := need(1, expected); message != success {
- return message
- }
-
- expectedString, expectedErr := remarshal(expected[0].(string))
- if expectedErr != nil {
- return "Expected value not valid JSON: " + expectedErr.Error()
- }
-
- actualString, actualErr := remarshal(actual.(string))
- if actualErr != nil {
- return "Actual value not valid JSON: " + actualErr.Error()
- }
-
- return ShouldEqual(actualString, expectedString)
-}
-func remarshal(value string) (string, error) {
- var structured interface{}
- err := json.Unmarshal([]byte(value), &structured)
- if err != nil {
- return "", err
- }
- canonical, _ := json.Marshal(structured)
- return string(canonical), nil
-}
-
-// ShouldResemble receives exactly two parameters and does a deep equal check (see reflect.DeepEqual)
-func ShouldResemble(actual interface{}, expected ...interface{}) string {
- if message := need(1, expected); message != success {
- return message
- }
-
- if matchError := oglematchers.DeepEquals(expected[0]).Matches(actual); matchError != nil {
- renderedExpected, renderedActual := render.Render(expected[0]), render.Render(actual)
- message := fmt.Sprintf(shouldHaveResembled, renderedExpected, renderedActual) +
- composePrettyDiff(renderedExpected, renderedActual)
- return serializer.serializeDetailed(expected[0], actual, message)
- }
-
- return success
-}
-
-// ShouldNotResemble receives exactly two parameters and does an inverse deep equal check (see reflect.DeepEqual)
-func ShouldNotResemble(actual interface{}, expected ...interface{}) string {
- if message := need(1, expected); message != success {
- return message
- } else if ShouldResemble(actual, expected[0]) == success {
- return fmt.Sprintf(shouldNotHaveResembled, render.Render(actual), render.Render(expected[0]))
- }
- return success
-}
-
-// ShouldPointTo receives exactly two parameters and checks to see that they point to the same address.
-func ShouldPointTo(actual interface{}, expected ...interface{}) string {
- if message := need(1, expected); message != success {
- return message
- }
- return shouldPointTo(actual, expected[0])
-
-}
-func shouldPointTo(actual, expected interface{}) string {
- actualValue := reflect.ValueOf(actual)
- expectedValue := reflect.ValueOf(expected)
-
- if ShouldNotBeNil(actual) != success {
- return fmt.Sprintf(shouldHaveBeenNonNilPointer, "first", "nil")
- } else if ShouldNotBeNil(expected) != success {
- return fmt.Sprintf(shouldHaveBeenNonNilPointer, "second", "nil")
- } else if actualValue.Kind() != reflect.Ptr {
- return fmt.Sprintf(shouldHaveBeenNonNilPointer, "first", "not")
- } else if expectedValue.Kind() != reflect.Ptr {
- return fmt.Sprintf(shouldHaveBeenNonNilPointer, "second", "not")
- } else if ShouldEqual(actualValue.Pointer(), expectedValue.Pointer()) != success {
- actualAddress := reflect.ValueOf(actual).Pointer()
- expectedAddress := reflect.ValueOf(expected).Pointer()
- return serializer.serialize(expectedAddress, actualAddress, fmt.Sprintf(shouldHavePointedTo,
- actual, actualAddress,
- expected, expectedAddress))
- }
- return success
-}
-
-// ShouldNotPointTo receives exactly two parameters and checks to see that they point to different addresess.
-func ShouldNotPointTo(actual interface{}, expected ...interface{}) string {
- if message := need(1, expected); message != success {
- return message
- }
- compare := ShouldPointTo(actual, expected[0])
- if strings.HasPrefix(compare, shouldBePointers) {
- return compare
- } else if compare == success {
- return fmt.Sprintf(shouldNotHavePointedTo, actual, expected[0], reflect.ValueOf(actual).Pointer())
- }
- return success
-}
-
-// ShouldBeNil receives a single parameter and ensures that it is nil.
-func ShouldBeNil(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- } else if actual == nil {
- return success
- } else if interfaceHasNilValue(actual) {
- return success
- }
- return fmt.Sprintf(shouldHaveBeenNil, actual)
-}
-func interfaceHasNilValue(actual interface{}) bool {
- value := reflect.ValueOf(actual)
- kind := value.Kind()
- nilable := kind == reflect.Slice ||
- kind == reflect.Chan ||
- kind == reflect.Func ||
- kind == reflect.Ptr ||
- kind == reflect.Map
-
- // Careful: reflect.Value.IsNil() will panic unless it's an interface, chan, map, func, slice, or ptr
- // Reference: http://golang.org/pkg/reflect/#Value.IsNil
- return nilable && value.IsNil()
-}
-
-// ShouldNotBeNil receives a single parameter and ensures that it is not nil.
-func ShouldNotBeNil(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- } else if ShouldBeNil(actual) == success {
- return fmt.Sprintf(shouldNotHaveBeenNil, actual)
- }
- return success
-}
-
-// ShouldBeTrue receives a single parameter and ensures that it is true.
-func ShouldBeTrue(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- } else if actual != true {
- return fmt.Sprintf(shouldHaveBeenTrue, actual)
- }
- return success
-}
-
-// ShouldBeFalse receives a single parameter and ensures that it is false.
-func ShouldBeFalse(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- } else if actual != false {
- return fmt.Sprintf(shouldHaveBeenFalse, actual)
- }
- return success
-}
-
-// ShouldBeZeroValue receives a single parameter and ensures that it is
-// the Go equivalent of the default value, or "zero" value.
-func ShouldBeZeroValue(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
- zeroVal := reflect.Zero(reflect.TypeOf(actual)).Interface()
- if !reflect.DeepEqual(zeroVal, actual) {
- return serializer.serialize(zeroVal, actual, fmt.Sprintf(shouldHaveBeenZeroValue, actual))
- }
- return success
-}
-
-// ShouldBeZeroValue receives a single parameter and ensures that it is NOT
-// the Go equivalent of the default value, or "zero" value.
-func ShouldNotBeZeroValue(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
- zeroVal := reflect.Zero(reflect.TypeOf(actual)).Interface()
- if reflect.DeepEqual(zeroVal, actual) {
- return serializer.serialize(zeroVal, actual, fmt.Sprintf(shouldNotHaveBeenZeroValue, actual))
- }
- return success
-}
diff --git a/vendor/github.com/smartystreets/assertions/equality_diff.go b/vendor/github.com/smartystreets/assertions/equality_diff.go
deleted file mode 100644
index bd698ff6..00000000
--- a/vendor/github.com/smartystreets/assertions/equality_diff.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package assertions
-
-import (
- "fmt"
-
- "github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch"
-)
-
-func composePrettyDiff(expected, actual string) string {
- diff := diffmatchpatch.New()
- diffs := diff.DiffMain(expected, actual, false)
- if prettyDiffIsLikelyToBeHelpful(diffs) {
- return fmt.Sprintf("\nDiff: '%s'", diff.DiffPrettyText(diffs))
- }
- return ""
-}
-
-// prettyDiffIsLikelyToBeHelpful returns true if the diff listing contains
-// more 'equal' segments than 'deleted'/'inserted' segments.
-func prettyDiffIsLikelyToBeHelpful(diffs []diffmatchpatch.Diff) bool {
- equal, deleted, inserted := measureDiffTypeLengths(diffs)
- return equal > deleted && equal > inserted
-}
-
-func measureDiffTypeLengths(diffs []diffmatchpatch.Diff) (equal, deleted, inserted int) {
- for _, segment := range diffs {
- switch segment.Type {
- case diffmatchpatch.DiffEqual:
- equal += len(segment.Text)
- case diffmatchpatch.DiffDelete:
- deleted += len(segment.Text)
- case diffmatchpatch.DiffInsert:
- inserted += len(segment.Text)
- }
- }
- return equal, deleted, inserted
-}
diff --git a/vendor/github.com/smartystreets/assertions/filter.go b/vendor/github.com/smartystreets/assertions/filter.go
deleted file mode 100644
index cbf75667..00000000
--- a/vendor/github.com/smartystreets/assertions/filter.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package assertions
-
-import "fmt"
-
-const (
- success = ""
- needExactValues = "This assertion requires exactly %d comparison values (you provided %d)."
- needNonEmptyCollection = "This assertion requires at least 1 comparison value (you provided 0)."
- needFewerValues = "This assertion allows %d or fewer comparison values (you provided %d)."
-)
-
-func need(needed int, expected []interface{}) string {
- if len(expected) != needed {
- return fmt.Sprintf(needExactValues, needed, len(expected))
- }
- return success
-}
-
-func atLeast(minimum int, expected []interface{}) string {
- if len(expected) < minimum {
- return needNonEmptyCollection
- }
- return success
-}
-
-func atMost(max int, expected []interface{}) string {
- if len(expected) > max {
- return fmt.Sprintf(needFewerValues, max, len(expected))
- }
- return success
-}
diff --git a/vendor/github.com/smartystreets/assertions/go.mod b/vendor/github.com/smartystreets/assertions/go.mod
deleted file mode 100644
index c0daaa3d..00000000
--- a/vendor/github.com/smartystreets/assertions/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module github.com/smartystreets/assertions
-
-go 1.12
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/LICENSE b/vendor/github.com/smartystreets/assertions/internal/go-diff/LICENSE
deleted file mode 100644
index 937942c2..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diff.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diff.go
deleted file mode 100644
index cb25b437..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diff.go
+++ /dev/null
@@ -1,1345 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "bytes"
- "errors"
- "fmt"
- "html"
- "math"
- "net/url"
- "regexp"
- "strconv"
- "strings"
- "time"
- "unicode/utf8"
-)
-
-// Operation defines the operation of a diff item.
-type Operation int8
-
-//go:generate stringer -type=Operation -trimprefix=Diff
-
-const (
- // DiffDelete item represents a delete diff.
- DiffDelete Operation = -1
- // DiffInsert item represents an insert diff.
- DiffInsert Operation = 1
- // DiffEqual item represents an equal diff.
- DiffEqual Operation = 0
-)
-
-// Diff represents one diff operation
-type Diff struct {
- Type Operation
- Text string
-}
-
-// splice removes amount elements from slice at index index, replacing them with elements.
-func splice(slice []Diff, index int, amount int, elements ...Diff) []Diff {
- if len(elements) == amount {
- // Easy case: overwrite the relevant items.
- copy(slice[index:], elements)
- return slice
- }
- if len(elements) < amount {
- // Fewer new items than old.
- // Copy in the new items.
- copy(slice[index:], elements)
- // Shift the remaining items left.
- copy(slice[index+len(elements):], slice[index+amount:])
- // Calculate the new end of the slice.
- end := len(slice) - amount + len(elements)
- // Zero stranded elements at end so that they can be garbage collected.
- tail := slice[end:]
- for i := range tail {
- tail[i] = Diff{}
- }
- return slice[:end]
- }
- // More new items than old.
- // Make room in slice for new elements.
- // There's probably an even more efficient way to do this,
- // but this is simple and clear.
- need := len(slice) - amount + len(elements)
- for len(slice) < need {
- slice = append(slice, Diff{})
- }
- // Shift slice elements right to make room for new elements.
- copy(slice[index+len(elements):], slice[index+amount:])
- // Copy in new elements.
- copy(slice[index:], elements)
- return slice
-}
-
-// DiffMain finds the differences between two texts.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-func (dmp *DiffMatchPatch) DiffMain(text1, text2 string, checklines bool) []Diff {
- return dmp.DiffMainRunes([]rune(text1), []rune(text2), checklines)
-}
-
-// DiffMainRunes finds the differences between two rune sequences.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-func (dmp *DiffMatchPatch) DiffMainRunes(text1, text2 []rune, checklines bool) []Diff {
- var deadline time.Time
- if dmp.DiffTimeout > 0 {
- deadline = time.Now().Add(dmp.DiffTimeout)
- }
- return dmp.diffMainRunes(text1, text2, checklines, deadline)
-}
-
-func (dmp *DiffMatchPatch) diffMainRunes(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
- if runesEqual(text1, text2) {
- var diffs []Diff
- if len(text1) > 0 {
- diffs = append(diffs, Diff{DiffEqual, string(text1)})
- }
- return diffs
- }
- // Trim off common prefix (speedup).
- commonlength := commonPrefixLength(text1, text2)
- commonprefix := text1[:commonlength]
- text1 = text1[commonlength:]
- text2 = text2[commonlength:]
-
- // Trim off common suffix (speedup).
- commonlength = commonSuffixLength(text1, text2)
- commonsuffix := text1[len(text1)-commonlength:]
- text1 = text1[:len(text1)-commonlength]
- text2 = text2[:len(text2)-commonlength]
-
- // Compute the diff on the middle block.
- diffs := dmp.diffCompute(text1, text2, checklines, deadline)
-
- // Restore the prefix and suffix.
- if len(commonprefix) != 0 {
- diffs = append([]Diff{Diff{DiffEqual, string(commonprefix)}}, diffs...)
- }
- if len(commonsuffix) != 0 {
- diffs = append(diffs, Diff{DiffEqual, string(commonsuffix)})
- }
-
- return dmp.DiffCleanupMerge(diffs)
-}
-
-// diffCompute finds the differences between two rune slices. Assumes that the texts do not have any common prefix or suffix.
-func (dmp *DiffMatchPatch) diffCompute(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
- diffs := []Diff{}
- if len(text1) == 0 {
- // Just add some text (speedup).
- return append(diffs, Diff{DiffInsert, string(text2)})
- } else if len(text2) == 0 {
- // Just delete some text (speedup).
- return append(diffs, Diff{DiffDelete, string(text1)})
- }
-
- var longtext, shorttext []rune
- if len(text1) > len(text2) {
- longtext = text1
- shorttext = text2
- } else {
- longtext = text2
- shorttext = text1
- }
-
- if i := runesIndex(longtext, shorttext); i != -1 {
- op := DiffInsert
- // Swap insertions for deletions if diff is reversed.
- if len(text1) > len(text2) {
- op = DiffDelete
- }
- // Shorter text is inside the longer text (speedup).
- return []Diff{
- Diff{op, string(longtext[:i])},
- Diff{DiffEqual, string(shorttext)},
- Diff{op, string(longtext[i+len(shorttext):])},
- }
- } else if len(shorttext) == 1 {
- // Single character string.
- // After the previous speedup, the character can't be an equality.
- return []Diff{
- Diff{DiffDelete, string(text1)},
- Diff{DiffInsert, string(text2)},
- }
- // Check to see if the problem can be split in two.
- } else if hm := dmp.diffHalfMatch(text1, text2); hm != nil {
- // A half-match was found, sort out the return data.
- text1A := hm[0]
- text1B := hm[1]
- text2A := hm[2]
- text2B := hm[3]
- midCommon := hm[4]
- // Send both pairs off for separate processing.
- diffsA := dmp.diffMainRunes(text1A, text2A, checklines, deadline)
- diffsB := dmp.diffMainRunes(text1B, text2B, checklines, deadline)
- // Merge the results.
- diffs := diffsA
- diffs = append(diffs, Diff{DiffEqual, string(midCommon)})
- diffs = append(diffs, diffsB...)
- return diffs
- } else if checklines && len(text1) > 100 && len(text2) > 100 {
- return dmp.diffLineMode(text1, text2, deadline)
- }
- return dmp.diffBisect(text1, text2, deadline)
-}
-
-// diffLineMode does a quick line-level diff on both []runes, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs.
-func (dmp *DiffMatchPatch) diffLineMode(text1, text2 []rune, deadline time.Time) []Diff {
- // Scan the text on a line-by-line basis first.
- text1, text2, linearray := dmp.diffLinesToRunes(text1, text2)
-
- diffs := dmp.diffMainRunes(text1, text2, false, deadline)
-
- // Convert the diff back to original text.
- diffs = dmp.DiffCharsToLines(diffs, linearray)
- // Eliminate freak matches (e.g. blank lines)
- diffs = dmp.DiffCleanupSemantic(diffs)
-
- // Rediff any replacement blocks, this time character-by-character.
- // Add a dummy entry at the end.
- diffs = append(diffs, Diff{DiffEqual, ""})
-
- pointer := 0
- countDelete := 0
- countInsert := 0
-
- // NOTE: Rune slices are slower than using strings in this case.
- textDelete := ""
- textInsert := ""
-
- for pointer < len(diffs) {
- switch diffs[pointer].Type {
- case DiffInsert:
- countInsert++
- textInsert += diffs[pointer].Text
- case DiffDelete:
- countDelete++
- textDelete += diffs[pointer].Text
- case DiffEqual:
- // Upon reaching an equality, check for prior redundancies.
- if countDelete >= 1 && countInsert >= 1 {
- // Delete the offending records and add the merged ones.
- diffs = splice(diffs, pointer-countDelete-countInsert,
- countDelete+countInsert)
-
- pointer = pointer - countDelete - countInsert
- a := dmp.diffMainRunes([]rune(textDelete), []rune(textInsert), false, deadline)
- for j := len(a) - 1; j >= 0; j-- {
- diffs = splice(diffs, pointer, 0, a[j])
- }
- pointer = pointer + len(a)
- }
-
- countInsert = 0
- countDelete = 0
- textDelete = ""
- textInsert = ""
- }
- pointer++
- }
-
- return diffs[:len(diffs)-1] // Remove the dummy entry at the end.
-}
-
-// DiffBisect finds the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-// See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-func (dmp *DiffMatchPatch) DiffBisect(text1, text2 string, deadline time.Time) []Diff {
- // Unused in this code, but retained for interface compatibility.
- return dmp.diffBisect([]rune(text1), []rune(text2), deadline)
-}
-
-// diffBisect finds the 'middle snake' of a diff, splits the problem in two and returns the recursively constructed diff.
-// See Myers's 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-func (dmp *DiffMatchPatch) diffBisect(runes1, runes2 []rune, deadline time.Time) []Diff {
- // Cache the text lengths to prevent multiple calls.
- runes1Len, runes2Len := len(runes1), len(runes2)
-
- maxD := (runes1Len + runes2Len + 1) / 2
- vOffset := maxD
- vLength := 2 * maxD
-
- v1 := make([]int, vLength)
- v2 := make([]int, vLength)
- for i := range v1 {
- v1[i] = -1
- v2[i] = -1
- }
- v1[vOffset+1] = 0
- v2[vOffset+1] = 0
-
- delta := runes1Len - runes2Len
- // If the total number of characters is odd, then the front path will collide with the reverse path.
- front := (delta%2 != 0)
- // Offsets for start and end of k loop. Prevents mapping of space beyond the grid.
- k1start := 0
- k1end := 0
- k2start := 0
- k2end := 0
- for d := 0; d < maxD; d++ {
- // Bail out if deadline is reached.
- if !deadline.IsZero() && d%16 == 0 && time.Now().After(deadline) {
- break
- }
-
- // Walk the front path one step.
- for k1 := -d + k1start; k1 <= d-k1end; k1 += 2 {
- k1Offset := vOffset + k1
- var x1 int
-
- if k1 == -d || (k1 != d && v1[k1Offset-1] < v1[k1Offset+1]) {
- x1 = v1[k1Offset+1]
- } else {
- x1 = v1[k1Offset-1] + 1
- }
-
- y1 := x1 - k1
- for x1 < runes1Len && y1 < runes2Len {
- if runes1[x1] != runes2[y1] {
- break
- }
- x1++
- y1++
- }
- v1[k1Offset] = x1
- if x1 > runes1Len {
- // Ran off the right of the graph.
- k1end += 2
- } else if y1 > runes2Len {
- // Ran off the bottom of the graph.
- k1start += 2
- } else if front {
- k2Offset := vOffset + delta - k1
- if k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] != -1 {
- // Mirror x2 onto top-left coordinate system.
- x2 := runes1Len - v2[k2Offset]
- if x1 >= x2 {
- // Overlap detected.
- return dmp.diffBisectSplit(runes1, runes2, x1, y1, deadline)
- }
- }
- }
- }
- // Walk the reverse path one step.
- for k2 := -d + k2start; k2 <= d-k2end; k2 += 2 {
- k2Offset := vOffset + k2
- var x2 int
- if k2 == -d || (k2 != d && v2[k2Offset-1] < v2[k2Offset+1]) {
- x2 = v2[k2Offset+1]
- } else {
- x2 = v2[k2Offset-1] + 1
- }
- var y2 = x2 - k2
- for x2 < runes1Len && y2 < runes2Len {
- if runes1[runes1Len-x2-1] != runes2[runes2Len-y2-1] {
- break
- }
- x2++
- y2++
- }
- v2[k2Offset] = x2
- if x2 > runes1Len {
- // Ran off the left of the graph.
- k2end += 2
- } else if y2 > runes2Len {
- // Ran off the top of the graph.
- k2start += 2
- } else if !front {
- k1Offset := vOffset + delta - k2
- if k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] != -1 {
- x1 := v1[k1Offset]
- y1 := vOffset + x1 - k1Offset
- // Mirror x2 onto top-left coordinate system.
- x2 = runes1Len - x2
- if x1 >= x2 {
- // Overlap detected.
- return dmp.diffBisectSplit(runes1, runes2, x1, y1, deadline)
- }
- }
- }
- }
- }
- // Diff took too long and hit the deadline or number of diffs equals number of characters, no commonality at all.
- return []Diff{
- Diff{DiffDelete, string(runes1)},
- Diff{DiffInsert, string(runes2)},
- }
-}
-
-func (dmp *DiffMatchPatch) diffBisectSplit(runes1, runes2 []rune, x, y int,
- deadline time.Time) []Diff {
- runes1a := runes1[:x]
- runes2a := runes2[:y]
- runes1b := runes1[x:]
- runes2b := runes2[y:]
-
- // Compute both diffs serially.
- diffs := dmp.diffMainRunes(runes1a, runes2a, false, deadline)
- diffsb := dmp.diffMainRunes(runes1b, runes2b, false, deadline)
-
- return append(diffs, diffsb...)
-}
-
-// DiffLinesToChars splits two texts into a list of strings, and educes the texts to a string of hashes where each Unicode character represents one line.
-// It's slightly faster to call DiffLinesToRunes first, followed by DiffMainRunes.
-func (dmp *DiffMatchPatch) DiffLinesToChars(text1, text2 string) (string, string, []string) {
- chars1, chars2, lineArray := dmp.DiffLinesToRunes(text1, text2)
- return string(chars1), string(chars2), lineArray
-}
-
-// DiffLinesToRunes splits two texts into a list of runes. Each rune represents one line.
-func (dmp *DiffMatchPatch) DiffLinesToRunes(text1, text2 string) ([]rune, []rune, []string) {
- // '\x00' is a valid character, but various debuggers don't like it. So we'll insert a junk entry to avoid generating a null character.
- lineArray := []string{""} // e.g. lineArray[4] == 'Hello\n'
- lineHash := map[string]int{} // e.g. lineHash['Hello\n'] == 4
-
- chars1 := dmp.diffLinesToRunesMunge(text1, &lineArray, lineHash)
- chars2 := dmp.diffLinesToRunesMunge(text2, &lineArray, lineHash)
-
- return chars1, chars2, lineArray
-}
-
-func (dmp *DiffMatchPatch) diffLinesToRunes(text1, text2 []rune) ([]rune, []rune, []string) {
- return dmp.DiffLinesToRunes(string(text1), string(text2))
-}
-
-// diffLinesToRunesMunge splits a text into an array of strings, and reduces the texts to a []rune where each Unicode character represents one line.
-// We use strings instead of []runes as input mainly because you can't use []rune as a map key.
-func (dmp *DiffMatchPatch) diffLinesToRunesMunge(text string, lineArray *[]string, lineHash map[string]int) []rune {
- // Walk the text, pulling out a substring for each line. text.split('\n') would would temporarily double our memory footprint. Modifying text would create many large strings to garbage collect.
- lineStart := 0
- lineEnd := -1
- runes := []rune{}
-
- for lineEnd < len(text)-1 {
- lineEnd = indexOf(text, "\n", lineStart)
-
- if lineEnd == -1 {
- lineEnd = len(text) - 1
- }
-
- line := text[lineStart : lineEnd+1]
- lineStart = lineEnd + 1
- lineValue, ok := lineHash[line]
-
- if ok {
- runes = append(runes, rune(lineValue))
- } else {
- *lineArray = append(*lineArray, line)
- lineHash[line] = len(*lineArray) - 1
- runes = append(runes, rune(len(*lineArray)-1))
- }
- }
-
- return runes
-}
-
-// DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text.
-func (dmp *DiffMatchPatch) DiffCharsToLines(diffs []Diff, lineArray []string) []Diff {
- hydrated := make([]Diff, 0, len(diffs))
- for _, aDiff := range diffs {
- chars := aDiff.Text
- text := make([]string, len(chars))
-
- for i, r := range chars {
- text[i] = lineArray[r]
- }
-
- aDiff.Text = strings.Join(text, "")
- hydrated = append(hydrated, aDiff)
- }
- return hydrated
-}
-
-// DiffCommonPrefix determines the common prefix length of two strings.
-func (dmp *DiffMatchPatch) DiffCommonPrefix(text1, text2 string) int {
- // Unused in this code, but retained for interface compatibility.
- return commonPrefixLength([]rune(text1), []rune(text2))
-}
-
-// DiffCommonSuffix determines the common suffix length of two strings.
-func (dmp *DiffMatchPatch) DiffCommonSuffix(text1, text2 string) int {
- // Unused in this code, but retained for interface compatibility.
- return commonSuffixLength([]rune(text1), []rune(text2))
-}
-
-// commonPrefixLength returns the length of the common prefix of two rune slices.
-func commonPrefixLength(text1, text2 []rune) int {
- // Linear search. See comment in commonSuffixLength.
- n := 0
- for ; n < len(text1) && n < len(text2); n++ {
- if text1[n] != text2[n] {
- return n
- }
- }
- return n
-}
-
-// commonSuffixLength returns the length of the common suffix of two rune slices.
-func commonSuffixLength(text1, text2 []rune) int {
- // Use linear search rather than the binary search discussed at https://neil.fraser.name/news/2007/10/09/.
- // See discussion at https://github.com/sergi/go-diff/issues/54.
- i1 := len(text1)
- i2 := len(text2)
- for n := 0; ; n++ {
- i1--
- i2--
- if i1 < 0 || i2 < 0 || text1[i1] != text2[i2] {
- return n
- }
- }
-}
-
-// DiffCommonOverlap determines if the suffix of one string is the prefix of another.
-func (dmp *DiffMatchPatch) DiffCommonOverlap(text1 string, text2 string) int {
- // Cache the text lengths to prevent multiple calls.
- text1Length := len(text1)
- text2Length := len(text2)
- // Eliminate the null case.
- if text1Length == 0 || text2Length == 0 {
- return 0
- }
- // Truncate the longer string.
- if text1Length > text2Length {
- text1 = text1[text1Length-text2Length:]
- } else if text1Length < text2Length {
- text2 = text2[0:text1Length]
- }
- textLength := int(math.Min(float64(text1Length), float64(text2Length)))
- // Quick check for the worst case.
- if text1 == text2 {
- return textLength
- }
-
- // Start by looking for a single character match and increase length until no match is found. Performance analysis: http://neil.fraser.name/news/2010/11/04/
- best := 0
- length := 1
- for {
- pattern := text1[textLength-length:]
- found := strings.Index(text2, pattern)
- if found == -1 {
- break
- }
- length += found
- if found == 0 || text1[textLength-length:] == text2[0:length] {
- best = length
- length++
- }
- }
-
- return best
-}
-
-// DiffHalfMatch checks whether the two texts share a substring which is at least half the length of the longer text. This speedup can produce non-minimal diffs.
-func (dmp *DiffMatchPatch) DiffHalfMatch(text1, text2 string) []string {
- // Unused in this code, but retained for interface compatibility.
- runeSlices := dmp.diffHalfMatch([]rune(text1), []rune(text2))
- if runeSlices == nil {
- return nil
- }
-
- result := make([]string, len(runeSlices))
- for i, r := range runeSlices {
- result[i] = string(r)
- }
- return result
-}
-
-func (dmp *DiffMatchPatch) diffHalfMatch(text1, text2 []rune) [][]rune {
- if dmp.DiffTimeout <= 0 {
- // Don't risk returning a non-optimal diff if we have unlimited time.
- return nil
- }
-
- var longtext, shorttext []rune
- if len(text1) > len(text2) {
- longtext = text1
- shorttext = text2
- } else {
- longtext = text2
- shorttext = text1
- }
-
- if len(longtext) < 4 || len(shorttext)*2 < len(longtext) {
- return nil // Pointless.
- }
-
- // First check if the second quarter is the seed for a half-match.
- hm1 := dmp.diffHalfMatchI(longtext, shorttext, int(float64(len(longtext)+3)/4))
-
- // Check again based on the third quarter.
- hm2 := dmp.diffHalfMatchI(longtext, shorttext, int(float64(len(longtext)+1)/2))
-
- hm := [][]rune{}
- if hm1 == nil && hm2 == nil {
- return nil
- } else if hm2 == nil {
- hm = hm1
- } else if hm1 == nil {
- hm = hm2
- } else {
- // Both matched. Select the longest.
- if len(hm1[4]) > len(hm2[4]) {
- hm = hm1
- } else {
- hm = hm2
- }
- }
-
- // A half-match was found, sort out the return data.
- if len(text1) > len(text2) {
- return hm
- }
-
- return [][]rune{hm[2], hm[3], hm[0], hm[1], hm[4]}
-}
-
-// diffHalfMatchI checks if a substring of shorttext exist within longtext such that the substring is at least half the length of longtext?
-// Returns a slice containing the prefix of longtext, the suffix of longtext, the prefix of shorttext, the suffix of shorttext and the common middle, or null if there was no match.
-func (dmp *DiffMatchPatch) diffHalfMatchI(l, s []rune, i int) [][]rune {
- var bestCommonA []rune
- var bestCommonB []rune
- var bestCommonLen int
- var bestLongtextA []rune
- var bestLongtextB []rune
- var bestShorttextA []rune
- var bestShorttextB []rune
-
- // Start with a 1/4 length substring at position i as a seed.
- seed := l[i : i+len(l)/4]
-
- for j := runesIndexOf(s, seed, 0); j != -1; j = runesIndexOf(s, seed, j+1) {
- prefixLength := commonPrefixLength(l[i:], s[j:])
- suffixLength := commonSuffixLength(l[:i], s[:j])
-
- if bestCommonLen < suffixLength+prefixLength {
- bestCommonA = s[j-suffixLength : j]
- bestCommonB = s[j : j+prefixLength]
- bestCommonLen = len(bestCommonA) + len(bestCommonB)
- bestLongtextA = l[:i-suffixLength]
- bestLongtextB = l[i+prefixLength:]
- bestShorttextA = s[:j-suffixLength]
- bestShorttextB = s[j+prefixLength:]
- }
- }
-
- if bestCommonLen*2 < len(l) {
- return nil
- }
-
- return [][]rune{
- bestLongtextA,
- bestLongtextB,
- bestShorttextA,
- bestShorttextB,
- append(bestCommonA, bestCommonB...),
- }
-}
-
-// DiffCleanupSemantic reduces the number of edits by eliminating semantically trivial equalities.
-func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
- changes := false
- // Stack of indices where equalities are found.
- equalities := make([]int, 0, len(diffs))
-
- var lastequality string
- // Always equal to diffs[equalities[equalitiesLength - 1]][1]
- var pointer int // Index of current position.
- // Number of characters that changed prior to the equality.
- var lengthInsertions1, lengthDeletions1 int
- // Number of characters that changed after the equality.
- var lengthInsertions2, lengthDeletions2 int
-
- for pointer < len(diffs) {
- if diffs[pointer].Type == DiffEqual {
- // Equality found.
- equalities = append(equalities, pointer)
- lengthInsertions1 = lengthInsertions2
- lengthDeletions1 = lengthDeletions2
- lengthInsertions2 = 0
- lengthDeletions2 = 0
- lastequality = diffs[pointer].Text
- } else {
- // An insertion or deletion.
-
- if diffs[pointer].Type == DiffInsert {
- lengthInsertions2 += len(diffs[pointer].Text)
- } else {
- lengthDeletions2 += len(diffs[pointer].Text)
- }
- // Eliminate an equality that is smaller or equal to the edits on both sides of it.
- difference1 := int(math.Max(float64(lengthInsertions1), float64(lengthDeletions1)))
- difference2 := int(math.Max(float64(lengthInsertions2), float64(lengthDeletions2)))
- if len(lastequality) > 0 &&
- (len(lastequality) <= difference1) &&
- (len(lastequality) <= difference2) {
- // Duplicate record.
- insPoint := equalities[len(equalities)-1]
- diffs = splice(diffs, insPoint, 0, Diff{DiffDelete, lastequality})
-
- // Change second copy to insert.
- diffs[insPoint+1].Type = DiffInsert
- // Throw away the equality we just deleted.
- equalities = equalities[:len(equalities)-1]
-
- if len(equalities) > 0 {
- equalities = equalities[:len(equalities)-1]
- }
- pointer = -1
- if len(equalities) > 0 {
- pointer = equalities[len(equalities)-1]
- }
-
- lengthInsertions1 = 0 // Reset the counters.
- lengthDeletions1 = 0
- lengthInsertions2 = 0
- lengthDeletions2 = 0
- lastequality = ""
- changes = true
- }
- }
- pointer++
- }
-
- // Normalize the diff.
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
- diffs = dmp.DiffCleanupSemanticLossless(diffs)
- // Find any overlaps between deletions and insertions.
- // e.g: <del>abcxxx</del><ins>xxxdef</ins>
- // -> <del>abc</del>xxx<ins>def</ins>
- // e.g: <del>xxxabc</del><ins>defxxx</ins>
- // -> <ins>def</ins>xxx<del>abc</del>
- // Only extract an overlap if it is as big as the edit ahead or behind it.
- pointer = 1
- for pointer < len(diffs) {
- if diffs[pointer-1].Type == DiffDelete &&
- diffs[pointer].Type == DiffInsert {
- deletion := diffs[pointer-1].Text
- insertion := diffs[pointer].Text
- overlapLength1 := dmp.DiffCommonOverlap(deletion, insertion)
- overlapLength2 := dmp.DiffCommonOverlap(insertion, deletion)
- if overlapLength1 >= overlapLength2 {
- if float64(overlapLength1) >= float64(len(deletion))/2 ||
- float64(overlapLength1) >= float64(len(insertion))/2 {
-
- // Overlap found. Insert an equality and trim the surrounding edits.
- diffs = splice(diffs, pointer, 0, Diff{DiffEqual, insertion[:overlapLength1]})
- diffs[pointer-1].Text =
- deletion[0 : len(deletion)-overlapLength1]
- diffs[pointer+1].Text = insertion[overlapLength1:]
- pointer++
- }
- } else {
- if float64(overlapLength2) >= float64(len(deletion))/2 ||
- float64(overlapLength2) >= float64(len(insertion))/2 {
- // Reverse overlap found. Insert an equality and swap and trim the surrounding edits.
- overlap := Diff{DiffEqual, deletion[:overlapLength2]}
- diffs = splice(diffs, pointer, 0, overlap)
- diffs[pointer-1].Type = DiffInsert
- diffs[pointer-1].Text = insertion[0 : len(insertion)-overlapLength2]
- diffs[pointer+1].Type = DiffDelete
- diffs[pointer+1].Text = deletion[overlapLength2:]
- pointer++
- }
- }
- pointer++
- }
- pointer++
- }
-
- return diffs
-}
-
-// Define some regex patterns for matching boundaries.
-var (
- nonAlphaNumericRegex = regexp.MustCompile(`[^a-zA-Z0-9]`)
- whitespaceRegex = regexp.MustCompile(`\s`)
- linebreakRegex = regexp.MustCompile(`[\r\n]`)
- blanklineEndRegex = regexp.MustCompile(`\n\r?\n$`)
- blanklineStartRegex = regexp.MustCompile(`^\r?\n\r?\n`)
-)
-
-// diffCleanupSemanticScore computes a score representing whether the internal boundary falls on logical boundaries.
-// Scores range from 6 (best) to 0 (worst). Closure, but does not reference any external variables.
-func diffCleanupSemanticScore(one, two string) int {
- if len(one) == 0 || len(two) == 0 {
- // Edges are the best.
- return 6
- }
-
- // Each port of this function behaves slightly differently due to subtle differences in each language's definition of things like 'whitespace'. Since this function's purpose is largely cosmetic, the choice has been made to use each language's native features rather than force total conformity.
- rune1, _ := utf8.DecodeLastRuneInString(one)
- rune2, _ := utf8.DecodeRuneInString(two)
- char1 := string(rune1)
- char2 := string(rune2)
-
- nonAlphaNumeric1 := nonAlphaNumericRegex.MatchString(char1)
- nonAlphaNumeric2 := nonAlphaNumericRegex.MatchString(char2)
- whitespace1 := nonAlphaNumeric1 && whitespaceRegex.MatchString(char1)
- whitespace2 := nonAlphaNumeric2 && whitespaceRegex.MatchString(char2)
- lineBreak1 := whitespace1 && linebreakRegex.MatchString(char1)
- lineBreak2 := whitespace2 && linebreakRegex.MatchString(char2)
- blankLine1 := lineBreak1 && blanklineEndRegex.MatchString(one)
- blankLine2 := lineBreak2 && blanklineEndRegex.MatchString(two)
-
- if blankLine1 || blankLine2 {
- // Five points for blank lines.
- return 5
- } else if lineBreak1 || lineBreak2 {
- // Four points for line breaks.
- return 4
- } else if nonAlphaNumeric1 && !whitespace1 && whitespace2 {
- // Three points for end of sentences.
- return 3
- } else if whitespace1 || whitespace2 {
- // Two points for whitespace.
- return 2
- } else if nonAlphaNumeric1 || nonAlphaNumeric2 {
- // One point for non-alphanumeric.
- return 1
- }
- return 0
-}
-
-// DiffCleanupSemanticLossless looks for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary.
-// E.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
-func (dmp *DiffMatchPatch) DiffCleanupSemanticLossless(diffs []Diff) []Diff {
- pointer := 1
-
- // Intentionally ignore the first and last element (don't need checking).
- for pointer < len(diffs)-1 {
- if diffs[pointer-1].Type == DiffEqual &&
- diffs[pointer+1].Type == DiffEqual {
-
- // This is a single edit surrounded by equalities.
- equality1 := diffs[pointer-1].Text
- edit := diffs[pointer].Text
- equality2 := diffs[pointer+1].Text
-
- // First, shift the edit as far left as possible.
- commonOffset := dmp.DiffCommonSuffix(equality1, edit)
- if commonOffset > 0 {
- commonString := edit[len(edit)-commonOffset:]
- equality1 = equality1[0 : len(equality1)-commonOffset]
- edit = commonString + edit[:len(edit)-commonOffset]
- equality2 = commonString + equality2
- }
-
- // Second, step character by character right, looking for the best fit.
- bestEquality1 := equality1
- bestEdit := edit
- bestEquality2 := equality2
- bestScore := diffCleanupSemanticScore(equality1, edit) +
- diffCleanupSemanticScore(edit, equality2)
-
- for len(edit) != 0 && len(equality2) != 0 {
- _, sz := utf8.DecodeRuneInString(edit)
- if len(equality2) < sz || edit[:sz] != equality2[:sz] {
- break
- }
- equality1 += edit[:sz]
- edit = edit[sz:] + equality2[:sz]
- equality2 = equality2[sz:]
- score := diffCleanupSemanticScore(equality1, edit) +
- diffCleanupSemanticScore(edit, equality2)
- // The >= encourages trailing rather than leading whitespace on edits.
- if score >= bestScore {
- bestScore = score
- bestEquality1 = equality1
- bestEdit = edit
- bestEquality2 = equality2
- }
- }
-
- if diffs[pointer-1].Text != bestEquality1 {
- // We have an improvement, save it back to the diff.
- if len(bestEquality1) != 0 {
- diffs[pointer-1].Text = bestEquality1
- } else {
- diffs = splice(diffs, pointer-1, 1)
- pointer--
- }
-
- diffs[pointer].Text = bestEdit
- if len(bestEquality2) != 0 {
- diffs[pointer+1].Text = bestEquality2
- } else {
- diffs = append(diffs[:pointer+1], diffs[pointer+2:]...)
- pointer--
- }
- }
- }
- pointer++
- }
-
- return diffs
-}
-
-// DiffCleanupEfficiency reduces the number of edits by eliminating operationally trivial equalities.
-func (dmp *DiffMatchPatch) DiffCleanupEfficiency(diffs []Diff) []Diff {
- changes := false
- // Stack of indices where equalities are found.
- type equality struct {
- data int
- next *equality
- }
- var equalities *equality
- // Always equal to equalities[equalitiesLength-1][1]
- lastequality := ""
- pointer := 0 // Index of current position.
- // Is there an insertion operation before the last equality.
- preIns := false
- // Is there a deletion operation before the last equality.
- preDel := false
- // Is there an insertion operation after the last equality.
- postIns := false
- // Is there a deletion operation after the last equality.
- postDel := false
- for pointer < len(diffs) {
- if diffs[pointer].Type == DiffEqual { // Equality found.
- if len(diffs[pointer].Text) < dmp.DiffEditCost &&
- (postIns || postDel) {
- // Candidate found.
- equalities = &equality{
- data: pointer,
- next: equalities,
- }
- preIns = postIns
- preDel = postDel
- lastequality = diffs[pointer].Text
- } else {
- // Not a candidate, and can never become one.
- equalities = nil
- lastequality = ""
- }
- postIns = false
- postDel = false
- } else { // An insertion or deletion.
- if diffs[pointer].Type == DiffDelete {
- postDel = true
- } else {
- postIns = true
- }
-
- // Five types to be split:
- // <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
- // <ins>A</ins>X<ins>C</ins><del>D</del>
- // <ins>A</ins><del>B</del>X<ins>C</ins>
- // <ins>A</del>X<ins>C</ins><del>D</del>
- // <ins>A</ins><del>B</del>X<del>C</del>
- var sumPres int
- if preIns {
- sumPres++
- }
- if preDel {
- sumPres++
- }
- if postIns {
- sumPres++
- }
- if postDel {
- sumPres++
- }
- if len(lastequality) > 0 &&
- ((preIns && preDel && postIns && postDel) ||
- ((len(lastequality) < dmp.DiffEditCost/2) && sumPres == 3)) {
-
- insPoint := equalities.data
-
- // Duplicate record.
- diffs = splice(diffs, insPoint, 0, Diff{DiffDelete, lastequality})
-
- // Change second copy to insert.
- diffs[insPoint+1].Type = DiffInsert
- // Throw away the equality we just deleted.
- equalities = equalities.next
- lastequality = ""
-
- if preIns && preDel {
- // No changes made which could affect previous entry, keep going.
- postIns = true
- postDel = true
- equalities = nil
- } else {
- if equalities != nil {
- equalities = equalities.next
- }
- if equalities != nil {
- pointer = equalities.data
- } else {
- pointer = -1
- }
- postIns = false
- postDel = false
- }
- changes = true
- }
- }
- pointer++
- }
-
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
-
- return diffs
-}
-
-// DiffCleanupMerge reorders and merges like edit sections. Merge equalities.
-// Any edit section can move as long as it doesn't cross an equality.
-func (dmp *DiffMatchPatch) DiffCleanupMerge(diffs []Diff) []Diff {
- // Add a dummy entry at the end.
- diffs = append(diffs, Diff{DiffEqual, ""})
- pointer := 0
- countDelete := 0
- countInsert := 0
- commonlength := 0
- textDelete := []rune(nil)
- textInsert := []rune(nil)
-
- for pointer < len(diffs) {
- switch diffs[pointer].Type {
- case DiffInsert:
- countInsert++
- textInsert = append(textInsert, []rune(diffs[pointer].Text)...)
- pointer++
- break
- case DiffDelete:
- countDelete++
- textDelete = append(textDelete, []rune(diffs[pointer].Text)...)
- pointer++
- break
- case DiffEqual:
- // Upon reaching an equality, check for prior redundancies.
- if countDelete+countInsert > 1 {
- if countDelete != 0 && countInsert != 0 {
- // Factor out any common prefixies.
- commonlength = commonPrefixLength(textInsert, textDelete)
- if commonlength != 0 {
- x := pointer - countDelete - countInsert
- if x > 0 && diffs[x-1].Type == DiffEqual {
- diffs[x-1].Text += string(textInsert[:commonlength])
- } else {
- diffs = append([]Diff{Diff{DiffEqual, string(textInsert[:commonlength])}}, diffs...)
- pointer++
- }
- textInsert = textInsert[commonlength:]
- textDelete = textDelete[commonlength:]
- }
- // Factor out any common suffixies.
- commonlength = commonSuffixLength(textInsert, textDelete)
- if commonlength != 0 {
- insertIndex := len(textInsert) - commonlength
- deleteIndex := len(textDelete) - commonlength
- diffs[pointer].Text = string(textInsert[insertIndex:]) + diffs[pointer].Text
- textInsert = textInsert[:insertIndex]
- textDelete = textDelete[:deleteIndex]
- }
- }
- // Delete the offending records and add the merged ones.
- if countDelete == 0 {
- diffs = splice(diffs, pointer-countInsert,
- countDelete+countInsert,
- Diff{DiffInsert, string(textInsert)})
- } else if countInsert == 0 {
- diffs = splice(diffs, pointer-countDelete,
- countDelete+countInsert,
- Diff{DiffDelete, string(textDelete)})
- } else {
- diffs = splice(diffs, pointer-countDelete-countInsert,
- countDelete+countInsert,
- Diff{DiffDelete, string(textDelete)},
- Diff{DiffInsert, string(textInsert)})
- }
-
- pointer = pointer - countDelete - countInsert + 1
- if countDelete != 0 {
- pointer++
- }
- if countInsert != 0 {
- pointer++
- }
- } else if pointer != 0 && diffs[pointer-1].Type == DiffEqual {
- // Merge this equality with the previous one.
- diffs[pointer-1].Text += diffs[pointer].Text
- diffs = append(diffs[:pointer], diffs[pointer+1:]...)
- } else {
- pointer++
- }
- countInsert = 0
- countDelete = 0
- textDelete = nil
- textInsert = nil
- break
- }
- }
-
- if len(diffs[len(diffs)-1].Text) == 0 {
- diffs = diffs[0 : len(diffs)-1] // Remove the dummy entry at the end.
- }
-
- // Second pass: look for single edits surrounded on both sides by equalities which can be shifted sideways to eliminate an equality. E.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
- changes := false
- pointer = 1
- // Intentionally ignore the first and last element (don't need checking).
- for pointer < (len(diffs) - 1) {
- if diffs[pointer-1].Type == DiffEqual &&
- diffs[pointer+1].Type == DiffEqual {
- // This is a single edit surrounded by equalities.
- if strings.HasSuffix(diffs[pointer].Text, diffs[pointer-1].Text) {
- // Shift the edit over the previous equality.
- diffs[pointer].Text = diffs[pointer-1].Text +
- diffs[pointer].Text[:len(diffs[pointer].Text)-len(diffs[pointer-1].Text)]
- diffs[pointer+1].Text = diffs[pointer-1].Text + diffs[pointer+1].Text
- diffs = splice(diffs, pointer-1, 1)
- changes = true
- } else if strings.HasPrefix(diffs[pointer].Text, diffs[pointer+1].Text) {
- // Shift the edit over the next equality.
- diffs[pointer-1].Text += diffs[pointer+1].Text
- diffs[pointer].Text =
- diffs[pointer].Text[len(diffs[pointer+1].Text):] + diffs[pointer+1].Text
- diffs = splice(diffs, pointer+1, 1)
- changes = true
- }
- }
- pointer++
- }
-
- // If shifts were made, the diff needs reordering and another shift sweep.
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
-
- return diffs
-}
-
-// DiffXIndex returns the equivalent location in s2.
-func (dmp *DiffMatchPatch) DiffXIndex(diffs []Diff, loc int) int {
- chars1 := 0
- chars2 := 0
- lastChars1 := 0
- lastChars2 := 0
- lastDiff := Diff{}
- for i := 0; i < len(diffs); i++ {
- aDiff := diffs[i]
- if aDiff.Type != DiffInsert {
- // Equality or deletion.
- chars1 += len(aDiff.Text)
- }
- if aDiff.Type != DiffDelete {
- // Equality or insertion.
- chars2 += len(aDiff.Text)
- }
- if chars1 > loc {
- // Overshot the location.
- lastDiff = aDiff
- break
- }
- lastChars1 = chars1
- lastChars2 = chars2
- }
- if lastDiff.Type == DiffDelete {
- // The location was deleted.
- return lastChars2
- }
- // Add the remaining character length.
- return lastChars2 + (loc - lastChars1)
-}
-
-// DiffPrettyHtml converts a []Diff into a pretty HTML report.
-// It is intended as an example from which to write one's own display functions.
-func (dmp *DiffMatchPatch) DiffPrettyHtml(diffs []Diff) string {
- var buff bytes.Buffer
- for _, diff := range diffs {
- text := strings.Replace(html.EscapeString(diff.Text), "\n", "&para;<br>", -1)
- switch diff.Type {
- case DiffInsert:
- _, _ = buff.WriteString("<ins style=\"background:#e6ffe6;\">")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("</ins>")
- case DiffDelete:
- _, _ = buff.WriteString("<del style=\"background:#ffe6e6;\">")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("</del>")
- case DiffEqual:
- _, _ = buff.WriteString("<span>")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("</span>")
- }
- }
- return buff.String()
-}
-
-// DiffPrettyText converts a []Diff into a colored text report.
-func (dmp *DiffMatchPatch) DiffPrettyText(diffs []Diff) string {
- var buff bytes.Buffer
- for _, diff := range diffs {
- text := diff.Text
-
- switch diff.Type {
- case DiffInsert:
- _, _ = buff.WriteString("\x1b[32m")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("\x1b[0m")
- case DiffDelete:
- _, _ = buff.WriteString("\x1b[31m")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("\x1b[0m")
- case DiffEqual:
- _, _ = buff.WriteString(text)
- }
- }
-
- return buff.String()
-}
-
-// DiffText1 computes and returns the source text (all equalities and deletions).
-func (dmp *DiffMatchPatch) DiffText1(diffs []Diff) string {
- //StringBuilder text = new StringBuilder()
- var text bytes.Buffer
-
- for _, aDiff := range diffs {
- if aDiff.Type != DiffInsert {
- _, _ = text.WriteString(aDiff.Text)
- }
- }
- return text.String()
-}
-
-// DiffText2 computes and returns the destination text (all equalities and insertions).
-func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {
- var text bytes.Buffer
-
- for _, aDiff := range diffs {
- if aDiff.Type != DiffDelete {
- _, _ = text.WriteString(aDiff.Text)
- }
- }
- return text.String()
-}
-
-// DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
-func (dmp *DiffMatchPatch) DiffLevenshtein(diffs []Diff) int {
- levenshtein := 0
- insertions := 0
- deletions := 0
-
- for _, aDiff := range diffs {
- switch aDiff.Type {
- case DiffInsert:
- insertions += utf8.RuneCountInString(aDiff.Text)
- case DiffDelete:
- deletions += utf8.RuneCountInString(aDiff.Text)
- case DiffEqual:
- // A deletion and an insertion is one substitution.
- levenshtein += max(insertions, deletions)
- insertions = 0
- deletions = 0
- }
- }
-
- levenshtein += max(insertions, deletions)
- return levenshtein
-}
-
-// DiffToDelta crushes the diff into an encoded string which describes the operations required to transform text1 into text2.
-// E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation.
-func (dmp *DiffMatchPatch) DiffToDelta(diffs []Diff) string {
- var text bytes.Buffer
- for _, aDiff := range diffs {
- switch aDiff.Type {
- case DiffInsert:
- _, _ = text.WriteString("+")
- _, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
- _, _ = text.WriteString("\t")
- break
- case DiffDelete:
- _, _ = text.WriteString("-")
- _, _ = text.WriteString(strconv.Itoa(utf8.RuneCountInString(aDiff.Text)))
- _, _ = text.WriteString("\t")
- break
- case DiffEqual:
- _, _ = text.WriteString("=")
- _, _ = text.WriteString(strconv.Itoa(utf8.RuneCountInString(aDiff.Text)))
- _, _ = text.WriteString("\t")
- break
- }
- }
- delta := text.String()
- if len(delta) != 0 {
- // Strip off trailing tab character.
- delta = delta[0 : utf8.RuneCountInString(delta)-1]
- delta = unescaper.Replace(delta)
- }
- return delta
-}
-
-// DiffFromDelta given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full diff.
-func (dmp *DiffMatchPatch) DiffFromDelta(text1 string, delta string) (diffs []Diff, err error) {
- i := 0
- runes := []rune(text1)
-
- for _, token := range strings.Split(delta, "\t") {
- if len(token) == 0 {
- // Blank tokens are ok (from a trailing \t).
- continue
- }
-
- // Each token begins with a one character parameter which specifies the operation of this token (delete, insert, equality).
- param := token[1:]
-
- switch op := token[0]; op {
- case '+':
- // Decode would Diff all "+" to " "
- param = strings.Replace(param, "+", "%2b", -1)
- param, err = url.QueryUnescape(param)
- if err != nil {
- return nil, err
- }
- if !utf8.ValidString(param) {
- return nil, fmt.Errorf("invalid UTF-8 token: %q", param)
- }
-
- diffs = append(diffs, Diff{DiffInsert, param})
- case '=', '-':
- n, err := strconv.ParseInt(param, 10, 0)
- if err != nil {
- return nil, err
- } else if n < 0 {
- return nil, errors.New("Negative number in DiffFromDelta: " + param)
- }
-
- i += int(n)
- // Break out if we are out of bounds, go1.6 can't handle this very well
- if i > len(runes) {
- break
- }
- // Remember that string slicing is by byte - we want by rune here.
- text := string(runes[i-int(n) : i])
-
- if op == '=' {
- diffs = append(diffs, Diff{DiffEqual, text})
- } else {
- diffs = append(diffs, Diff{DiffDelete, text})
- }
- default:
- // Anything else is an error.
- return nil, errors.New("Invalid diff operation in DiffFromDelta: " + string(token[0]))
- }
- }
-
- if i != len(runes) {
- return nil, fmt.Errorf("Delta length (%v) is different from source text length (%v)", i, len(text1))
- }
-
- return diffs, nil
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go
deleted file mode 100644
index d3acc32c..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-// Package diffmatchpatch offers robust algorithms to perform the operations required for synchronizing plain text.
-package diffmatchpatch
-
-import (
- "time"
-)
-
-// DiffMatchPatch holds the configuration for diff-match-patch operations.
-type DiffMatchPatch struct {
- // Number of seconds to map a diff before giving up (0 for infinity).
- DiffTimeout time.Duration
- // Cost of an empty edit operation in terms of edit characters.
- DiffEditCost int
- // How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
- MatchDistance int
- // When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that MatchThreshold controls how closely the end points of a delete need to match.
- PatchDeleteThreshold float64
- // Chunk size for context length.
- PatchMargin int
- // The number of bits in an int.
- MatchMaxBits int
- // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
- MatchThreshold float64
-}
-
-// New creates a new DiffMatchPatch object with default parameters.
-func New() *DiffMatchPatch {
- // Defaults.
- return &DiffMatchPatch{
- DiffTimeout: time.Second,
- DiffEditCost: 4,
- MatchThreshold: 0.5,
- MatchDistance: 1000,
- PatchDeleteThreshold: 0.5,
- PatchMargin: 4,
- MatchMaxBits: 32,
- }
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/match.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/match.go
deleted file mode 100644
index 17374e10..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/match.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "math"
-)
-
-// MatchMain locates the best instance of 'pattern' in 'text' near 'loc'.
-// Returns -1 if no match found.
-func (dmp *DiffMatchPatch) MatchMain(text, pattern string, loc int) int {
- // Check for null inputs not needed since null can't be passed in C#.
-
- loc = int(math.Max(0, math.Min(float64(loc), float64(len(text)))))
- if text == pattern {
- // Shortcut (potentially not guaranteed by the algorithm)
- return 0
- } else if len(text) == 0 {
- // Nothing to match.
- return -1
- } else if loc+len(pattern) <= len(text) && text[loc:loc+len(pattern)] == pattern {
- // Perfect match at the perfect spot! (Includes case of null pattern)
- return loc
- }
- // Do a fuzzy compare.
- return dmp.MatchBitap(text, pattern, loc)
-}
-
-// MatchBitap locates the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm.
-// Returns -1 if no match was found.
-func (dmp *DiffMatchPatch) MatchBitap(text, pattern string, loc int) int {
- // Initialise the alphabet.
- s := dmp.MatchAlphabet(pattern)
-
- // Highest score beyond which we give up.
- scoreThreshold := dmp.MatchThreshold
- // Is there a nearby exact match? (speedup)
- bestLoc := indexOf(text, pattern, loc)
- if bestLoc != -1 {
- scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
- pattern), scoreThreshold)
- // What about in the other direction? (speedup)
- bestLoc = lastIndexOf(text, pattern, loc+len(pattern))
- if bestLoc != -1 {
- scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
- pattern), scoreThreshold)
- }
- }
-
- // Initialise the bit arrays.
- matchmask := 1 << uint((len(pattern) - 1))
- bestLoc = -1
-
- var binMin, binMid int
- binMax := len(pattern) + len(text)
- lastRd := []int{}
- for d := 0; d < len(pattern); d++ {
- // Scan for the best match; each iteration allows for one more error. Run a binary search to determine how far from 'loc' we can stray at this error level.
- binMin = 0
- binMid = binMax
- for binMin < binMid {
- if dmp.matchBitapScore(d, loc+binMid, loc, pattern) <= scoreThreshold {
- binMin = binMid
- } else {
- binMax = binMid
- }
- binMid = (binMax-binMin)/2 + binMin
- }
- // Use the result from this iteration as the maximum for the next.
- binMax = binMid
- start := int(math.Max(1, float64(loc-binMid+1)))
- finish := int(math.Min(float64(loc+binMid), float64(len(text))) + float64(len(pattern)))
-
- rd := make([]int, finish+2)
- rd[finish+1] = (1 << uint(d)) - 1
-
- for j := finish; j >= start; j-- {
- var charMatch int
- if len(text) <= j-1 {
- // Out of range.
- charMatch = 0
- } else if _, ok := s[text[j-1]]; !ok {
- charMatch = 0
- } else {
- charMatch = s[text[j-1]]
- }
-
- if d == 0 {
- // First pass: exact match.
- rd[j] = ((rd[j+1] << 1) | 1) & charMatch
- } else {
- // Subsequent passes: fuzzy match.
- rd[j] = ((rd[j+1]<<1)|1)&charMatch | (((lastRd[j+1] | lastRd[j]) << 1) | 1) | lastRd[j+1]
- }
- if (rd[j] & matchmask) != 0 {
- score := dmp.matchBitapScore(d, j-1, loc, pattern)
- // This match will almost certainly be better than any existing match. But check anyway.
- if score <= scoreThreshold {
- // Told you so.
- scoreThreshold = score
- bestLoc = j - 1
- if bestLoc > loc {
- // When passing loc, don't exceed our current distance from loc.
- start = int(math.Max(1, float64(2*loc-bestLoc)))
- } else {
- // Already passed loc, downhill from here on in.
- break
- }
- }
- }
- }
- if dmp.matchBitapScore(d+1, loc, loc, pattern) > scoreThreshold {
- // No hope for a (better) match at greater error levels.
- break
- }
- lastRd = rd
- }
- return bestLoc
-}
-
-// matchBitapScore computes and returns the score for a match with e errors and x location.
-func (dmp *DiffMatchPatch) matchBitapScore(e, x, loc int, pattern string) float64 {
- accuracy := float64(e) / float64(len(pattern))
- proximity := math.Abs(float64(loc - x))
- if dmp.MatchDistance == 0 {
- // Dodge divide by zero error.
- if proximity == 0 {
- return accuracy
- }
-
- return 1.0
- }
- return accuracy + (proximity / float64(dmp.MatchDistance))
-}
-
-// MatchAlphabet initialises the alphabet for the Bitap algorithm.
-func (dmp *DiffMatchPatch) MatchAlphabet(pattern string) map[byte]int {
- s := map[byte]int{}
- charPattern := []byte(pattern)
- for _, c := range charPattern {
- _, ok := s[c]
- if !ok {
- s[c] = 0
- }
- }
- i := 0
-
- for _, c := range charPattern {
- value := s[c] | int(uint(1)<<uint((len(pattern)-i-1)))
- s[c] = value
- i++
- }
- return s
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/mathutil.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/mathutil.go
deleted file mode 100644
index aed242bc..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/mathutil.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-func min(x, y int) int {
- if x < y {
- return x
- }
- return y
-}
-
-func max(x, y int) int {
- if x > y {
- return x
- }
- return y
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/operation_string.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/operation_string.go
deleted file mode 100644
index 533ec0da..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/operation_string.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Code generated by "stringer -type=Operation -trimprefix=Diff"; DO NOT EDIT.
-
-package diffmatchpatch
-
-import "fmt"
-
-const _Operation_name = "DeleteEqualInsert"
-
-var _Operation_index = [...]uint8{0, 6, 11, 17}
-
-func (i Operation) String() string {
- i -= -1
- if i < 0 || i >= Operation(len(_Operation_index)-1) {
- return fmt.Sprintf("Operation(%d)", i+-1)
- }
- return _Operation_name[_Operation_index[i]:_Operation_index[i+1]]
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/patch.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/patch.go
deleted file mode 100644
index 223c43c4..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/patch.go
+++ /dev/null
@@ -1,556 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "bytes"
- "errors"
- "math"
- "net/url"
- "regexp"
- "strconv"
- "strings"
-)
-
-// Patch represents one patch operation.
-type Patch struct {
- diffs []Diff
- Start1 int
- Start2 int
- Length1 int
- Length2 int
-}
-
-// String emulates GNU diff's format.
-// Header: @@ -382,8 +481,9 @@
-// Indices are printed as 1-based, not 0-based.
-func (p *Patch) String() string {
- var coords1, coords2 string
-
- if p.Length1 == 0 {
- coords1 = strconv.Itoa(p.Start1) + ",0"
- } else if p.Length1 == 1 {
- coords1 = strconv.Itoa(p.Start1 + 1)
- } else {
- coords1 = strconv.Itoa(p.Start1+1) + "," + strconv.Itoa(p.Length1)
- }
-
- if p.Length2 == 0 {
- coords2 = strconv.Itoa(p.Start2) + ",0"
- } else if p.Length2 == 1 {
- coords2 = strconv.Itoa(p.Start2 + 1)
- } else {
- coords2 = strconv.Itoa(p.Start2+1) + "," + strconv.Itoa(p.Length2)
- }
-
- var text bytes.Buffer
- _, _ = text.WriteString("@@ -" + coords1 + " +" + coords2 + " @@\n")
-
- // Escape the body of the patch with %xx notation.
- for _, aDiff := range p.diffs {
- switch aDiff.Type {
- case DiffInsert:
- _, _ = text.WriteString("+")
- case DiffDelete:
- _, _ = text.WriteString("-")
- case DiffEqual:
- _, _ = text.WriteString(" ")
- }
-
- _, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
- _, _ = text.WriteString("\n")
- }
-
- return unescaper.Replace(text.String())
-}
-
-// PatchAddContext increases the context until it is unique, but doesn't let the pattern expand beyond MatchMaxBits.
-func (dmp *DiffMatchPatch) PatchAddContext(patch Patch, text string) Patch {
- if len(text) == 0 {
- return patch
- }
-
- pattern := text[patch.Start2 : patch.Start2+patch.Length1]
- padding := 0
-
- // Look for the first and last matches of pattern in text. If two different matches are found, increase the pattern length.
- for strings.Index(text, pattern) != strings.LastIndex(text, pattern) &&
- len(pattern) < dmp.MatchMaxBits-2*dmp.PatchMargin {
- padding += dmp.PatchMargin
- maxStart := max(0, patch.Start2-padding)
- minEnd := min(len(text), patch.Start2+patch.Length1+padding)
- pattern = text[maxStart:minEnd]
- }
- // Add one chunk for good luck.
- padding += dmp.PatchMargin
-
- // Add the prefix.
- prefix := text[max(0, patch.Start2-padding):patch.Start2]
- if len(prefix) != 0 {
- patch.diffs = append([]Diff{Diff{DiffEqual, prefix}}, patch.diffs...)
- }
- // Add the suffix.
- suffix := text[patch.Start2+patch.Length1 : min(len(text), patch.Start2+patch.Length1+padding)]
- if len(suffix) != 0 {
- patch.diffs = append(patch.diffs, Diff{DiffEqual, suffix})
- }
-
- // Roll back the start points.
- patch.Start1 -= len(prefix)
- patch.Start2 -= len(prefix)
- // Extend the lengths.
- patch.Length1 += len(prefix) + len(suffix)
- patch.Length2 += len(prefix) + len(suffix)
-
- return patch
-}
-
-// PatchMake computes a list of patches.
-func (dmp *DiffMatchPatch) PatchMake(opt ...interface{}) []Patch {
- if len(opt) == 1 {
- diffs, _ := opt[0].([]Diff)
- text1 := dmp.DiffText1(diffs)
- return dmp.PatchMake(text1, diffs)
- } else if len(opt) == 2 {
- text1 := opt[0].(string)
- switch t := opt[1].(type) {
- case string:
- diffs := dmp.DiffMain(text1, t, true)
- if len(diffs) > 2 {
- diffs = dmp.DiffCleanupSemantic(diffs)
- diffs = dmp.DiffCleanupEfficiency(diffs)
- }
- return dmp.PatchMake(text1, diffs)
- case []Diff:
- return dmp.patchMake2(text1, t)
- }
- } else if len(opt) == 3 {
- return dmp.PatchMake(opt[0], opt[2])
- }
- return []Patch{}
-}
-
-// patchMake2 computes a list of patches to turn text1 into text2.
-// text2 is not provided, diffs are the delta between text1 and text2.
-func (dmp *DiffMatchPatch) patchMake2(text1 string, diffs []Diff) []Patch {
- // Check for null inputs not needed since null can't be passed in C#.
- patches := []Patch{}
- if len(diffs) == 0 {
- return patches // Get rid of the null case.
- }
-
- patch := Patch{}
- charCount1 := 0 // Number of characters into the text1 string.
- charCount2 := 0 // Number of characters into the text2 string.
- // Start with text1 (prepatchText) and apply the diffs until we arrive at text2 (postpatchText). We recreate the patches one by one to determine context info.
- prepatchText := text1
- postpatchText := text1
-
- for i, aDiff := range diffs {
- if len(patch.diffs) == 0 && aDiff.Type != DiffEqual {
- // A new patch starts here.
- patch.Start1 = charCount1
- patch.Start2 = charCount2
- }
-
- switch aDiff.Type {
- case DiffInsert:
- patch.diffs = append(patch.diffs, aDiff)
- patch.Length2 += len(aDiff.Text)
- postpatchText = postpatchText[:charCount2] +
- aDiff.Text + postpatchText[charCount2:]
- case DiffDelete:
- patch.Length1 += len(aDiff.Text)
- patch.diffs = append(patch.diffs, aDiff)
- postpatchText = postpatchText[:charCount2] + postpatchText[charCount2+len(aDiff.Text):]
- case DiffEqual:
- if len(aDiff.Text) <= 2*dmp.PatchMargin &&
- len(patch.diffs) != 0 && i != len(diffs)-1 {
- // Small equality inside a patch.
- patch.diffs = append(patch.diffs, aDiff)
- patch.Length1 += len(aDiff.Text)
- patch.Length2 += len(aDiff.Text)
- }
- if len(aDiff.Text) >= 2*dmp.PatchMargin {
- // Time for a new patch.
- if len(patch.diffs) != 0 {
- patch = dmp.PatchAddContext(patch, prepatchText)
- patches = append(patches, patch)
- patch = Patch{}
- // Unlike Unidiff, our patch lists have a rolling context. http://code.google.com/p/google-diff-match-patch/wiki/Unidiff Update prepatch text & pos to reflect the application of the just completed patch.
- prepatchText = postpatchText
- charCount1 = charCount2
- }
- }
- }
-
- // Update the current character count.
- if aDiff.Type != DiffInsert {
- charCount1 += len(aDiff.Text)
- }
- if aDiff.Type != DiffDelete {
- charCount2 += len(aDiff.Text)
- }
- }
-
- // Pick up the leftover patch if not empty.
- if len(patch.diffs) != 0 {
- patch = dmp.PatchAddContext(patch, prepatchText)
- patches = append(patches, patch)
- }
-
- return patches
-}
-
-// PatchDeepCopy returns an array that is identical to a given an array of patches.
-func (dmp *DiffMatchPatch) PatchDeepCopy(patches []Patch) []Patch {
- patchesCopy := []Patch{}
- for _, aPatch := range patches {
- patchCopy := Patch{}
- for _, aDiff := range aPatch.diffs {
- patchCopy.diffs = append(patchCopy.diffs, Diff{
- aDiff.Type,
- aDiff.Text,
- })
- }
- patchCopy.Start1 = aPatch.Start1
- patchCopy.Start2 = aPatch.Start2
- patchCopy.Length1 = aPatch.Length1
- patchCopy.Length2 = aPatch.Length2
- patchesCopy = append(patchesCopy, patchCopy)
- }
- return patchesCopy
-}
-
-// PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were applied.
-func (dmp *DiffMatchPatch) PatchApply(patches []Patch, text string) (string, []bool) {
- if len(patches) == 0 {
- return text, []bool{}
- }
-
- // Deep copy the patches so that no changes are made to originals.
- patches = dmp.PatchDeepCopy(patches)
-
- nullPadding := dmp.PatchAddPadding(patches)
- text = nullPadding + text + nullPadding
- patches = dmp.PatchSplitMax(patches)
-
- x := 0
- // delta keeps track of the offset between the expected and actual location of the previous patch. If there are patches expected at positions 10 and 20, but the first patch was found at 12, delta is 2 and the second patch has an effective expected position of 22.
- delta := 0
- results := make([]bool, len(patches))
- for _, aPatch := range patches {
- expectedLoc := aPatch.Start2 + delta
- text1 := dmp.DiffText1(aPatch.diffs)
- var startLoc int
- endLoc := -1
- if len(text1) > dmp.MatchMaxBits {
- // PatchSplitMax will only provide an oversized pattern in the case of a monster delete.
- startLoc = dmp.MatchMain(text, text1[:dmp.MatchMaxBits], expectedLoc)
- if startLoc != -1 {
- endLoc = dmp.MatchMain(text,
- text1[len(text1)-dmp.MatchMaxBits:], expectedLoc+len(text1)-dmp.MatchMaxBits)
- if endLoc == -1 || startLoc >= endLoc {
- // Can't find valid trailing context. Drop this patch.
- startLoc = -1
- }
- }
- } else {
- startLoc = dmp.MatchMain(text, text1, expectedLoc)
- }
- if startLoc == -1 {
- // No match found. :(
- results[x] = false
- // Subtract the delta for this failed patch from subsequent patches.
- delta -= aPatch.Length2 - aPatch.Length1
- } else {
- // Found a match. :)
- results[x] = true
- delta = startLoc - expectedLoc
- var text2 string
- if endLoc == -1 {
- text2 = text[startLoc:int(math.Min(float64(startLoc+len(text1)), float64(len(text))))]
- } else {
- text2 = text[startLoc:int(math.Min(float64(endLoc+dmp.MatchMaxBits), float64(len(text))))]
- }
- if text1 == text2 {
- // Perfect match, just shove the Replacement text in.
- text = text[:startLoc] + dmp.DiffText2(aPatch.diffs) + text[startLoc+len(text1):]
- } else {
- // Imperfect match. Run a diff to get a framework of equivalent indices.
- diffs := dmp.DiffMain(text1, text2, false)
- if len(text1) > dmp.MatchMaxBits && float64(dmp.DiffLevenshtein(diffs))/float64(len(text1)) > dmp.PatchDeleteThreshold {
- // The end points match, but the content is unacceptably bad.
- results[x] = false
- } else {
- diffs = dmp.DiffCleanupSemanticLossless(diffs)
- index1 := 0
- for _, aDiff := range aPatch.diffs {
- if aDiff.Type != DiffEqual {
- index2 := dmp.DiffXIndex(diffs, index1)
- if aDiff.Type == DiffInsert {
- // Insertion
- text = text[:startLoc+index2] + aDiff.Text + text[startLoc+index2:]
- } else if aDiff.Type == DiffDelete {
- // Deletion
- startIndex := startLoc + index2
- text = text[:startIndex] +
- text[startIndex+dmp.DiffXIndex(diffs, index1+len(aDiff.Text))-index2:]
- }
- }
- if aDiff.Type != DiffDelete {
- index1 += len(aDiff.Text)
- }
- }
- }
- }
- }
- x++
- }
- // Strip the padding off.
- text = text[len(nullPadding) : len(nullPadding)+(len(text)-2*len(nullPadding))]
- return text, results
-}
-
-// PatchAddPadding adds some padding on text start and end so that edges can match something.
-// Intended to be called only from within patchApply.
-func (dmp *DiffMatchPatch) PatchAddPadding(patches []Patch) string {
- paddingLength := dmp.PatchMargin
- nullPadding := ""
- for x := 1; x <= paddingLength; x++ {
- nullPadding += string(x)
- }
-
- // Bump all the patches forward.
- for i := range patches {
- patches[i].Start1 += paddingLength
- patches[i].Start2 += paddingLength
- }
-
- // Add some padding on start of first diff.
- if len(patches[0].diffs) == 0 || patches[0].diffs[0].Type != DiffEqual {
- // Add nullPadding equality.
- patches[0].diffs = append([]Diff{Diff{DiffEqual, nullPadding}}, patches[0].diffs...)
- patches[0].Start1 -= paddingLength // Should be 0.
- patches[0].Start2 -= paddingLength // Should be 0.
- patches[0].Length1 += paddingLength
- patches[0].Length2 += paddingLength
- } else if paddingLength > len(patches[0].diffs[0].Text) {
- // Grow first equality.
- extraLength := paddingLength - len(patches[0].diffs[0].Text)
- patches[0].diffs[0].Text = nullPadding[len(patches[0].diffs[0].Text):] + patches[0].diffs[0].Text
- patches[0].Start1 -= extraLength
- patches[0].Start2 -= extraLength
- patches[0].Length1 += extraLength
- patches[0].Length2 += extraLength
- }
-
- // Add some padding on end of last diff.
- last := len(patches) - 1
- if len(patches[last].diffs) == 0 || patches[last].diffs[len(patches[last].diffs)-1].Type != DiffEqual {
- // Add nullPadding equality.
- patches[last].diffs = append(patches[last].diffs, Diff{DiffEqual, nullPadding})
- patches[last].Length1 += paddingLength
- patches[last].Length2 += paddingLength
- } else if paddingLength > len(patches[last].diffs[len(patches[last].diffs)-1].Text) {
- // Grow last equality.
- lastDiff := patches[last].diffs[len(patches[last].diffs)-1]
- extraLength := paddingLength - len(lastDiff.Text)
- patches[last].diffs[len(patches[last].diffs)-1].Text += nullPadding[:extraLength]
- patches[last].Length1 += extraLength
- patches[last].Length2 += extraLength
- }
-
- return nullPadding
-}
-
-// PatchSplitMax looks through the patches and breaks up any which are longer than the maximum limit of the match algorithm.
-// Intended to be called only from within patchApply.
-func (dmp *DiffMatchPatch) PatchSplitMax(patches []Patch) []Patch {
- patchSize := dmp.MatchMaxBits
- for x := 0; x < len(patches); x++ {
- if patches[x].Length1 <= patchSize {
- continue
- }
- bigpatch := patches[x]
- // Remove the big old patch.
- patches = append(patches[:x], patches[x+1:]...)
- x--
-
- Start1 := bigpatch.Start1
- Start2 := bigpatch.Start2
- precontext := ""
- for len(bigpatch.diffs) != 0 {
- // Create one of several smaller patches.
- patch := Patch{}
- empty := true
- patch.Start1 = Start1 - len(precontext)
- patch.Start2 = Start2 - len(precontext)
- if len(precontext) != 0 {
- patch.Length1 = len(precontext)
- patch.Length2 = len(precontext)
- patch.diffs = append(patch.diffs, Diff{DiffEqual, precontext})
- }
- for len(bigpatch.diffs) != 0 && patch.Length1 < patchSize-dmp.PatchMargin {
- diffType := bigpatch.diffs[0].Type
- diffText := bigpatch.diffs[0].Text
- if diffType == DiffInsert {
- // Insertions are harmless.
- patch.Length2 += len(diffText)
- Start2 += len(diffText)
- patch.diffs = append(patch.diffs, bigpatch.diffs[0])
- bigpatch.diffs = bigpatch.diffs[1:]
- empty = false
- } else if diffType == DiffDelete && len(patch.diffs) == 1 && patch.diffs[0].Type == DiffEqual && len(diffText) > 2*patchSize {
- // This is a large deletion. Let it pass in one chunk.
- patch.Length1 += len(diffText)
- Start1 += len(diffText)
- empty = false
- patch.diffs = append(patch.diffs, Diff{diffType, diffText})
- bigpatch.diffs = bigpatch.diffs[1:]
- } else {
- // Deletion or equality. Only take as much as we can stomach.
- diffText = diffText[:min(len(diffText), patchSize-patch.Length1-dmp.PatchMargin)]
-
- patch.Length1 += len(diffText)
- Start1 += len(diffText)
- if diffType == DiffEqual {
- patch.Length2 += len(diffText)
- Start2 += len(diffText)
- } else {
- empty = false
- }
- patch.diffs = append(patch.diffs, Diff{diffType, diffText})
- if diffText == bigpatch.diffs[0].Text {
- bigpatch.diffs = bigpatch.diffs[1:]
- } else {
- bigpatch.diffs[0].Text =
- bigpatch.diffs[0].Text[len(diffText):]
- }
- }
- }
- // Compute the head context for the next patch.
- precontext = dmp.DiffText2(patch.diffs)
- precontext = precontext[max(0, len(precontext)-dmp.PatchMargin):]
-
- postcontext := ""
- // Append the end context for this patch.
- if len(dmp.DiffText1(bigpatch.diffs)) > dmp.PatchMargin {
- postcontext = dmp.DiffText1(bigpatch.diffs)[:dmp.PatchMargin]
- } else {
- postcontext = dmp.DiffText1(bigpatch.diffs)
- }
-
- if len(postcontext) != 0 {
- patch.Length1 += len(postcontext)
- patch.Length2 += len(postcontext)
- if len(patch.diffs) != 0 && patch.diffs[len(patch.diffs)-1].Type == DiffEqual {
- patch.diffs[len(patch.diffs)-1].Text += postcontext
- } else {
- patch.diffs = append(patch.diffs, Diff{DiffEqual, postcontext})
- }
- }
- if !empty {
- x++
- patches = append(patches[:x], append([]Patch{patch}, patches[x:]...)...)
- }
- }
- }
- return patches
-}
-
-// PatchToText takes a list of patches and returns a textual representation.
-func (dmp *DiffMatchPatch) PatchToText(patches []Patch) string {
- var text bytes.Buffer
- for _, aPatch := range patches {
- _, _ = text.WriteString(aPatch.String())
- }
- return text.String()
-}
-
-// PatchFromText parses a textual representation of patches and returns a List of Patch objects.
-func (dmp *DiffMatchPatch) PatchFromText(textline string) ([]Patch, error) {
- patches := []Patch{}
- if len(textline) == 0 {
- return patches, nil
- }
- text := strings.Split(textline, "\n")
- textPointer := 0
- patchHeader := regexp.MustCompile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$")
-
- var patch Patch
- var sign uint8
- var line string
- for textPointer < len(text) {
-
- if !patchHeader.MatchString(text[textPointer]) {
- return patches, errors.New("Invalid patch string: " + text[textPointer])
- }
-
- patch = Patch{}
- m := patchHeader.FindStringSubmatch(text[textPointer])
-
- patch.Start1, _ = strconv.Atoi(m[1])
- if len(m[2]) == 0 {
- patch.Start1--
- patch.Length1 = 1
- } else if m[2] == "0" {
- patch.Length1 = 0
- } else {
- patch.Start1--
- patch.Length1, _ = strconv.Atoi(m[2])
- }
-
- patch.Start2, _ = strconv.Atoi(m[3])
-
- if len(m[4]) == 0 {
- patch.Start2--
- patch.Length2 = 1
- } else if m[4] == "0" {
- patch.Length2 = 0
- } else {
- patch.Start2--
- patch.Length2, _ = strconv.Atoi(m[4])
- }
- textPointer++
-
- for textPointer < len(text) {
- if len(text[textPointer]) > 0 {
- sign = text[textPointer][0]
- } else {
- textPointer++
- continue
- }
-
- line = text[textPointer][1:]
- line = strings.Replace(line, "+", "%2b", -1)
- line, _ = url.QueryUnescape(line)
- if sign == '-' {
- // Deletion.
- patch.diffs = append(patch.diffs, Diff{DiffDelete, line})
- } else if sign == '+' {
- // Insertion.
- patch.diffs = append(patch.diffs, Diff{DiffInsert, line})
- } else if sign == ' ' {
- // Minor equality.
- patch.diffs = append(patch.diffs, Diff{DiffEqual, line})
- } else if sign == '@' {
- // Start of next patch.
- break
- } else {
- // WTF?
- return patches, errors.New("Invalid patch mode '" + string(sign) + "' in: " + string(line))
- }
- textPointer++
- }
-
- patches = append(patches, patch)
- }
- return patches, nil
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/stringutil.go b/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/stringutil.go
deleted file mode 100644
index 265f29cc..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/stringutil.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "strings"
- "unicode/utf8"
-)
-
-// unescaper unescapes selected chars for compatibility with JavaScript's encodeURI.
-// In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3F" would not be unescaped. But this is ok because it is only called with the output of HttpUtility.UrlEncode which returns lowercase hex. Example: "%3f" -> "?", "%24" -> "$", etc.
-var unescaper = strings.NewReplacer(
- "%21", "!", "%7E", "~", "%27", "'",
- "%28", "(", "%29", ")", "%3B", ";",
- "%2F", "/", "%3F", "?", "%3A", ":",
- "%40", "@", "%26", "&", "%3D", "=",
- "%2B", "+", "%24", "$", "%2C", ",", "%23", "#", "%2A", "*")
-
-// indexOf returns the first index of pattern in str, starting at str[i].
-func indexOf(str string, pattern string, i int) int {
- if i > len(str)-1 {
- return -1
- }
- if i <= 0 {
- return strings.Index(str, pattern)
- }
- ind := strings.Index(str[i:], pattern)
- if ind == -1 {
- return -1
- }
- return ind + i
-}
-
-// lastIndexOf returns the last index of pattern in str, starting at str[i].
-func lastIndexOf(str string, pattern string, i int) int {
- if i < 0 {
- return -1
- }
- if i >= len(str) {
- return strings.LastIndex(str, pattern)
- }
- _, size := utf8.DecodeRuneInString(str[i:])
- return strings.LastIndex(str[:i+size], pattern)
-}
-
-// runesIndexOf returns the index of pattern in target, starting at target[i].
-func runesIndexOf(target, pattern []rune, i int) int {
- if i > len(target)-1 {
- return -1
- }
- if i <= 0 {
- return runesIndex(target, pattern)
- }
- ind := runesIndex(target[i:], pattern)
- if ind == -1 {
- return -1
- }
- return ind + i
-}
-
-func runesEqual(r1, r2 []rune) bool {
- if len(r1) != len(r2) {
- return false
- }
- for i, c := range r1 {
- if c != r2[i] {
- return false
- }
- }
- return true
-}
-
-// runesIndex is the equivalent of strings.Index for rune slices.
-func runesIndex(r1, r2 []rune) int {
- last := len(r1) - len(r2)
- for i := 0; i <= last; i++ {
- if runesEqual(r1[i:i+len(r2)], r2) {
- return i
- }
- }
- return -1
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE b/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE
deleted file mode 100644
index 6280ff0e..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go b/vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go
deleted file mode 100644
index 313611ef..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go
+++ /dev/null
@@ -1,481 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package render
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "sort"
- "strconv"
-)
-
-var builtinTypeMap = map[reflect.Kind]string{
- reflect.Bool: "bool",
- reflect.Complex128: "complex128",
- reflect.Complex64: "complex64",
- reflect.Float32: "float32",
- reflect.Float64: "float64",
- reflect.Int16: "int16",
- reflect.Int32: "int32",
- reflect.Int64: "int64",
- reflect.Int8: "int8",
- reflect.Int: "int",
- reflect.String: "string",
- reflect.Uint16: "uint16",
- reflect.Uint32: "uint32",
- reflect.Uint64: "uint64",
- reflect.Uint8: "uint8",
- reflect.Uint: "uint",
- reflect.Uintptr: "uintptr",
-}
-
-var builtinTypeSet = map[string]struct{}{}
-
-func init() {
- for _, v := range builtinTypeMap {
- builtinTypeSet[v] = struct{}{}
- }
-}
-
-var typeOfString = reflect.TypeOf("")
-var typeOfInt = reflect.TypeOf(int(1))
-var typeOfUint = reflect.TypeOf(uint(1))
-var typeOfFloat = reflect.TypeOf(10.1)
-
-// Render converts a structure to a string representation. Unline the "%#v"
-// format string, this resolves pointer types' contents in structs, maps, and
-// slices/arrays and prints their field values.
-func Render(v interface{}) string {
- buf := bytes.Buffer{}
- s := (*traverseState)(nil)
- s.render(&buf, 0, reflect.ValueOf(v), false)
- return buf.String()
-}
-
-// renderPointer is called to render a pointer value.
-//
-// This is overridable so that the test suite can have deterministic pointer
-// values in its expectations.
-var renderPointer = func(buf *bytes.Buffer, p uintptr) {
- fmt.Fprintf(buf, "0x%016x", p)
-}
-
-// traverseState is used to note and avoid recursion as struct members are being
-// traversed.
-//
-// traverseState is allowed to be nil. Specifically, the root state is nil.
-type traverseState struct {
- parent *traverseState
- ptr uintptr
-}
-
-func (s *traverseState) forkFor(ptr uintptr) *traverseState {
- for cur := s; cur != nil; cur = cur.parent {
- if ptr == cur.ptr {
- return nil
- }
- }
-
- fs := &traverseState{
- parent: s,
- ptr: ptr,
- }
- return fs
-}
-
-func (s *traverseState) render(buf *bytes.Buffer, ptrs int, v reflect.Value, implicit bool) {
- if v.Kind() == reflect.Invalid {
- buf.WriteString("nil")
- return
- }
- vt := v.Type()
-
- // If the type being rendered is a potentially recursive type (a type that
- // can contain itself as a member), we need to avoid recursion.
- //
- // If we've already seen this type before, mark that this is the case and
- // write a recursion placeholder instead of actually rendering it.
- //
- // If we haven't seen it before, fork our `seen` tracking so any higher-up
- // renderers will also render it at least once, then mark that we've seen it
- // to avoid recursing on lower layers.
- pe := uintptr(0)
- vk := vt.Kind()
- switch vk {
- case reflect.Ptr:
- // Since structs and arrays aren't pointers, they can't directly be
- // recursed, but they can contain pointers to themselves. Record their
- // pointer to avoid this.
- switch v.Elem().Kind() {
- case reflect.Struct, reflect.Array:
- pe = v.Pointer()
- }
-
- case reflect.Slice, reflect.Map:
- pe = v.Pointer()
- }
- if pe != 0 {
- s = s.forkFor(pe)
- if s == nil {
- buf.WriteString("<REC(")
- if !implicit {
- writeType(buf, ptrs, vt)
- }
- buf.WriteString(")>")
- return
- }
- }
-
- isAnon := func(t reflect.Type) bool {
- if t.Name() != "" {
- if _, ok := builtinTypeSet[t.Name()]; !ok {
- return false
- }
- }
- return t.Kind() != reflect.Interface
- }
-
- switch vk {
- case reflect.Struct:
- if !implicit {
- writeType(buf, ptrs, vt)
- }
- buf.WriteRune('{')
- if rendered, ok := renderTime(v); ok {
- buf.WriteString(rendered)
- } else {
- structAnon := vt.Name() == ""
- for i := 0; i < vt.NumField(); i++ {
- if i > 0 {
- buf.WriteString(", ")
- }
- anon := structAnon && isAnon(vt.Field(i).Type)
-
- if !anon {
- buf.WriteString(vt.Field(i).Name)
- buf.WriteRune(':')
- }
-
- s.render(buf, 0, v.Field(i), anon)
- }
- }
- buf.WriteRune('}')
-
- case reflect.Slice:
- if v.IsNil() {
- if !implicit {
- writeType(buf, ptrs, vt)
- buf.WriteString("(nil)")
- } else {
- buf.WriteString("nil")
- }
- return
- }
- fallthrough
-
- case reflect.Array:
- if !implicit {
- writeType(buf, ptrs, vt)
- }
- anon := vt.Name() == "" && isAnon(vt.Elem())
- buf.WriteString("{")
- for i := 0; i < v.Len(); i++ {
- if i > 0 {
- buf.WriteString(", ")
- }
-
- s.render(buf, 0, v.Index(i), anon)
- }
- buf.WriteRune('}')
-
- case reflect.Map:
- if !implicit {
- writeType(buf, ptrs, vt)
- }
- if v.IsNil() {
- buf.WriteString("(nil)")
- } else {
- buf.WriteString("{")
-
- mkeys := v.MapKeys()
- tryAndSortMapKeys(vt, mkeys)
-
- kt := vt.Key()
- keyAnon := typeOfString.ConvertibleTo(kt) || typeOfInt.ConvertibleTo(kt) || typeOfUint.ConvertibleTo(kt) || typeOfFloat.ConvertibleTo(kt)
- valAnon := vt.Name() == "" && isAnon(vt.Elem())
- for i, mk := range mkeys {
- if i > 0 {
- buf.WriteString(", ")
- }
-
- s.render(buf, 0, mk, keyAnon)
- buf.WriteString(":")
- s.render(buf, 0, v.MapIndex(mk), valAnon)
- }
- buf.WriteRune('}')
- }
-
- case reflect.Ptr:
- ptrs++
- fallthrough
- case reflect.Interface:
- if v.IsNil() {
- writeType(buf, ptrs, v.Type())
- buf.WriteString("(nil)")
- } else {
- s.render(buf, ptrs, v.Elem(), false)
- }
-
- case reflect.Chan, reflect.Func, reflect.UnsafePointer:
- writeType(buf, ptrs, vt)
- buf.WriteRune('(')
- renderPointer(buf, v.Pointer())
- buf.WriteRune(')')
-
- default:
- tstr := vt.String()
- implicit = implicit || (ptrs == 0 && builtinTypeMap[vk] == tstr)
- if !implicit {
- writeType(buf, ptrs, vt)
- buf.WriteRune('(')
- }
-
- switch vk {
- case reflect.String:
- fmt.Fprintf(buf, "%q", v.String())
- case reflect.Bool:
- fmt.Fprintf(buf, "%v", v.Bool())
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- fmt.Fprintf(buf, "%d", v.Int())
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- fmt.Fprintf(buf, "%d", v.Uint())
-
- case reflect.Float32, reflect.Float64:
- fmt.Fprintf(buf, "%g", v.Float())
-
- case reflect.Complex64, reflect.Complex128:
- fmt.Fprintf(buf, "%g", v.Complex())
- }
-
- if !implicit {
- buf.WriteRune(')')
- }
- }
-}
-
-func writeType(buf *bytes.Buffer, ptrs int, t reflect.Type) {
- parens := ptrs > 0
- switch t.Kind() {
- case reflect.Chan, reflect.Func, reflect.UnsafePointer:
- parens = true
- }
-
- if parens {
- buf.WriteRune('(')
- for i := 0; i < ptrs; i++ {
- buf.WriteRune('*')
- }
- }
-
- switch t.Kind() {
- case reflect.Ptr:
- if ptrs == 0 {
- // This pointer was referenced from within writeType (e.g., as part of
- // rendering a list), and so hasn't had its pointer asterisk accounted
- // for.
- buf.WriteRune('*')
- }
- writeType(buf, 0, t.Elem())
-
- case reflect.Interface:
- if n := t.Name(); n != "" {
- buf.WriteString(t.String())
- } else {
- buf.WriteString("interface{}")
- }
-
- case reflect.Array:
- buf.WriteRune('[')
- buf.WriteString(strconv.FormatInt(int64(t.Len()), 10))
- buf.WriteRune(']')
- writeType(buf, 0, t.Elem())
-
- case reflect.Slice:
- if t == reflect.SliceOf(t.Elem()) {
- buf.WriteString("[]")
- writeType(buf, 0, t.Elem())
- } else {
- // Custom slice type, use type name.
- buf.WriteString(t.String())
- }
-
- case reflect.Map:
- if t == reflect.MapOf(t.Key(), t.Elem()) {
- buf.WriteString("map[")
- writeType(buf, 0, t.Key())
- buf.WriteRune(']')
- writeType(buf, 0, t.Elem())
- } else {
- // Custom map type, use type name.
- buf.WriteString(t.String())
- }
-
- default:
- buf.WriteString(t.String())
- }
-
- if parens {
- buf.WriteRune(')')
- }
-}
-
-type cmpFn func(a, b reflect.Value) int
-
-type sortableValueSlice struct {
- cmp cmpFn
- elements []reflect.Value
-}
-
-func (s sortableValueSlice) Len() int {
- return len(s.elements)
-}
-
-func (s sortableValueSlice) Less(i, j int) bool {
- return s.cmp(s.elements[i], s.elements[j]) < 0
-}
-
-func (s sortableValueSlice) Swap(i, j int) {
- s.elements[i], s.elements[j] = s.elements[j], s.elements[i]
-}
-
-// cmpForType returns a cmpFn which sorts the data for some type t in the same
-// order that a go-native map key is compared for equality.
-func cmpForType(t reflect.Type) cmpFn {
- switch t.Kind() {
- case reflect.String:
- return func(av, bv reflect.Value) int {
- a, b := av.String(), bv.String()
- if a < b {
- return -1
- } else if a > b {
- return 1
- }
- return 0
- }
-
- case reflect.Bool:
- return func(av, bv reflect.Value) int {
- a, b := av.Bool(), bv.Bool()
- if !a && b {
- return -1
- } else if a && !b {
- return 1
- }
- return 0
- }
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return func(av, bv reflect.Value) int {
- a, b := av.Int(), bv.Int()
- if a < b {
- return -1
- } else if a > b {
- return 1
- }
- return 0
- }
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32,
- reflect.Uint64, reflect.Uintptr, reflect.UnsafePointer:
- return func(av, bv reflect.Value) int {
- a, b := av.Uint(), bv.Uint()
- if a < b {
- return -1
- } else if a > b {
- return 1
- }
- return 0
- }
-
- case reflect.Float32, reflect.Float64:
- return func(av, bv reflect.Value) int {
- a, b := av.Float(), bv.Float()
- if a < b {
- return -1
- } else if a > b {
- return 1
- }
- return 0
- }
-
- case reflect.Interface:
- return func(av, bv reflect.Value) int {
- a, b := av.InterfaceData(), bv.InterfaceData()
- if a[0] < b[0] {
- return -1
- } else if a[0] > b[0] {
- return 1
- }
- if a[1] < b[1] {
- return -1
- } else if a[1] > b[1] {
- return 1
- }
- return 0
- }
-
- case reflect.Complex64, reflect.Complex128:
- return func(av, bv reflect.Value) int {
- a, b := av.Complex(), bv.Complex()
- if real(a) < real(b) {
- return -1
- } else if real(a) > real(b) {
- return 1
- }
- if imag(a) < imag(b) {
- return -1
- } else if imag(a) > imag(b) {
- return 1
- }
- return 0
- }
-
- case reflect.Ptr, reflect.Chan:
- return func(av, bv reflect.Value) int {
- a, b := av.Pointer(), bv.Pointer()
- if a < b {
- return -1
- } else if a > b {
- return 1
- }
- return 0
- }
-
- case reflect.Struct:
- cmpLst := make([]cmpFn, t.NumField())
- for i := range cmpLst {
- cmpLst[i] = cmpForType(t.Field(i).Type)
- }
- return func(a, b reflect.Value) int {
- for i, cmp := range cmpLst {
- if rslt := cmp(a.Field(i), b.Field(i)); rslt != 0 {
- return rslt
- }
- }
- return 0
- }
- }
-
- return nil
-}
-
-func tryAndSortMapKeys(mt reflect.Type, k []reflect.Value) {
- if cmp := cmpForType(mt.Key()); cmp != nil {
- sort.Sort(sortableValueSlice{cmp, k})
- }
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go b/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go
deleted file mode 100644
index 990c75d0..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package render
-
-import (
- "reflect"
- "time"
-)
-
-func renderTime(value reflect.Value) (string, bool) {
- if instant, ok := convertTime(value); !ok {
- return "", false
- } else if instant.IsZero() {
- return "0", true
- } else {
- return instant.String(), true
- }
-}
-
-func convertTime(value reflect.Value) (t time.Time, ok bool) {
- if value.Type() == timeType {
- defer func() { recover() }()
- t, ok = value.Interface().(time.Time)
- }
- return
-}
-
-var timeType = reflect.TypeOf(time.Time{})
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE b/vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE
deleted file mode 100644
index d6456956..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md b/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md
deleted file mode 100644
index 215a2bb7..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-[![GoDoc](https://godoc.org/github.com/smartystreets/assertions/internal/oglematchers?status.svg)](https://godoc.org/github.com/smartystreets/assertions/internal/oglematchers)
-
-`oglematchers` is a package for the Go programming language containing a set of
-matchers, useful in a testing or mocking framework, inspired by and mostly
-compatible with [Google Test][googletest] for C++ and
-[Google JS Test][google-js-test]. The package is used by the
-[ogletest][ogletest] testing framework and [oglemock][oglemock] mocking
-framework, which may be more directly useful to you, but can be generically used
-elsewhere as well.
-
-A "matcher" is simply an object with a `Matches` method defining a set of golang
-values matched by the matcher, and a `Description` method describing that set.
-For example, here are some matchers:
-
-```go
-// Numbers
-Equals(17.13)
-LessThan(19)
-
-// Strings
-Equals("taco")
-HasSubstr("burrito")
-MatchesRegex("t.*o")
-
-// Combining matchers
-AnyOf(LessThan(17), GreaterThan(19))
-```
-
-There are lots more; see [here][reference] for a reference. You can also add
-your own simply by implementing the `oglematchers.Matcher` interface.
-
-
-Installation
-------------
-
-First, make sure you have installed Go 1.0.2 or newer. See
-[here][golang-install] for instructions.
-
-Use the following command to install `oglematchers` and keep it up to date:
-
- go get -u github.com/smartystreets/assertions/internal/oglematchers
-
-
-Documentation
--------------
-
-See [here][reference] for documentation. Alternatively, you can install the
-package and then use `godoc`:
-
- godoc github.com/smartystreets/assertions/internal/oglematchers
-
-
-[reference]: http://godoc.org/github.com/smartystreets/assertions/internal/oglematchers
-[golang-install]: http://golang.org/doc/install.html
-[googletest]: http://code.google.com/p/googletest/
-[google-js-test]: http://code.google.com/p/google-js-test/
-[ogletest]: http://github.com/smartystreets/assertions/internal/ogletest
-[oglemock]: http://github.com/smartystreets/assertions/internal/oglemock
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go
deleted file mode 100644
index 2918b51f..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strings"
-)
-
-// AnyOf accepts a set of values S and returns a matcher that follows the
-// algorithm below when considering a candidate c:
-//
-// 1. If there exists a value m in S such that m implements the Matcher
-// interface and m matches c, return true.
-//
-// 2. Otherwise, if there exists a value v in S such that v does not implement
-// the Matcher interface and the matcher Equals(v) matches c, return true.
-//
-// 3. Otherwise, if there is a value m in S such that m implements the Matcher
-// interface and m returns a fatal error for c, return that fatal error.
-//
-// 4. Otherwise, return false.
-//
-// This is akin to a logical OR operation for matchers, with non-matchers x
-// being treated as Equals(x).
-func AnyOf(vals ...interface{}) Matcher {
- // Get ahold of a type variable for the Matcher interface.
- var dummy *Matcher
- matcherType := reflect.TypeOf(dummy).Elem()
-
- // Create a matcher for each value, or use the value itself if it's already a
- // matcher.
- wrapped := make([]Matcher, len(vals))
- for i, v := range vals {
- t := reflect.TypeOf(v)
- if t != nil && t.Implements(matcherType) {
- wrapped[i] = v.(Matcher)
- } else {
- wrapped[i] = Equals(v)
- }
- }
-
- return &anyOfMatcher{wrapped}
-}
-
-type anyOfMatcher struct {
- wrapped []Matcher
-}
-
-func (m *anyOfMatcher) Description() string {
- wrappedDescs := make([]string, len(m.wrapped))
- for i, matcher := range m.wrapped {
- wrappedDescs[i] = matcher.Description()
- }
-
- return fmt.Sprintf("or(%s)", strings.Join(wrappedDescs, ", "))
-}
-
-func (m *anyOfMatcher) Matches(c interface{}) (err error) {
- err = errors.New("")
-
- // Try each matcher in turn.
- for _, matcher := range m.wrapped {
- wrappedErr := matcher.Matches(c)
-
- // Return immediately if there's a match.
- if wrappedErr == nil {
- err = nil
- return
- }
-
- // Note the fatal error, if any.
- if _, isFatal := wrappedErr.(*FatalError); isFatal {
- err = wrappedErr
- }
- }
-
- return
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go
deleted file mode 100644
index 87f107d3..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// Return a matcher that matches arrays slices with at least one element that
-// matches the supplied argument. If the argument x is not itself a Matcher,
-// this is equivalent to Contains(Equals(x)).
-func Contains(x interface{}) Matcher {
- var result containsMatcher
- var ok bool
-
- if result.elementMatcher, ok = x.(Matcher); !ok {
- result.elementMatcher = DeepEquals(x)
- }
-
- return &result
-}
-
-type containsMatcher struct {
- elementMatcher Matcher
-}
-
-func (m *containsMatcher) Description() string {
- return fmt.Sprintf("contains: %s", m.elementMatcher.Description())
-}
-
-func (m *containsMatcher) Matches(candidate interface{}) error {
- // The candidate must be a slice or an array.
- v := reflect.ValueOf(candidate)
- if v.Kind() != reflect.Slice && v.Kind() != reflect.Array {
- return NewFatalError("which is not a slice or array")
- }
-
- // Check each element.
- for i := 0; i < v.Len(); i++ {
- elem := v.Index(i)
- if matchErr := m.elementMatcher.Matches(elem.Interface()); matchErr == nil {
- return nil
- }
- }
-
- return fmt.Errorf("")
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go
deleted file mode 100644
index 1d91baef..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "bytes"
- "errors"
- "fmt"
- "reflect"
-)
-
-var byteSliceType reflect.Type = reflect.TypeOf([]byte{})
-
-// DeepEquals returns a matcher that matches based on 'deep equality', as
-// defined by the reflect package. This matcher requires that values have
-// identical types to x.
-func DeepEquals(x interface{}) Matcher {
- return &deepEqualsMatcher{x}
-}
-
-type deepEqualsMatcher struct {
- x interface{}
-}
-
-func (m *deepEqualsMatcher) Description() string {
- xDesc := fmt.Sprintf("%v", m.x)
- xValue := reflect.ValueOf(m.x)
-
- // Special case: fmt.Sprintf presents nil slices as "[]", but
- // reflect.DeepEqual makes a distinction between nil and empty slices. Make
- // this less confusing.
- if xValue.Kind() == reflect.Slice && xValue.IsNil() {
- xDesc = "<nil slice>"
- }
-
- return fmt.Sprintf("deep equals: %s", xDesc)
-}
-
-func (m *deepEqualsMatcher) Matches(c interface{}) error {
- // Make sure the types match.
- ct := reflect.TypeOf(c)
- xt := reflect.TypeOf(m.x)
-
- if ct != xt {
- return NewFatalError(fmt.Sprintf("which is of type %v", ct))
- }
-
- // Special case: handle byte slices more efficiently.
- cValue := reflect.ValueOf(c)
- xValue := reflect.ValueOf(m.x)
-
- if ct == byteSliceType && !cValue.IsNil() && !xValue.IsNil() {
- xBytes := m.x.([]byte)
- cBytes := c.([]byte)
-
- if bytes.Equal(cBytes, xBytes) {
- return nil
- }
-
- return errors.New("")
- }
-
- // Defer to the reflect package.
- if reflect.DeepEqual(m.x, c) {
- return nil
- }
-
- // Special case: if the comparison failed because c is the nil slice, given
- // an indication of this (since its value is printed as "[]").
- if cValue.Kind() == reflect.Slice && cValue.IsNil() {
- return errors.New("which is nil")
- }
-
- return errors.New("")
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go
deleted file mode 100644
index a510707b..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go
+++ /dev/null
@@ -1,541 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
-)
-
-// Equals(x) returns a matcher that matches values v such that v and x are
-// equivalent. This includes the case when the comparison v == x using Go's
-// built-in comparison operator is legal (except for structs, which this
-// matcher does not support), but for convenience the following rules also
-// apply:
-//
-// * Type checking is done based on underlying types rather than actual
-// types, so that e.g. two aliases for string can be compared:
-//
-// type stringAlias1 string
-// type stringAlias2 string
-//
-// a := "taco"
-// b := stringAlias1("taco")
-// c := stringAlias2("taco")
-//
-// ExpectTrue(a == b) // Legal, passes
-// ExpectTrue(b == c) // Illegal, doesn't compile
-//
-// ExpectThat(a, Equals(b)) // Passes
-// ExpectThat(b, Equals(c)) // Passes
-//
-// * Values of numeric type are treated as if they were abstract numbers, and
-// compared accordingly. Therefore Equals(17) will match int(17),
-// int16(17), uint(17), float32(17), complex64(17), and so on.
-//
-// If you want a stricter matcher that contains no such cleverness, see
-// IdenticalTo instead.
-//
-// Arrays are supported by this matcher, but do not participate in the
-// exceptions above. Two arrays compared with this matcher must have identical
-// types, and their element type must itself be comparable according to Go's ==
-// operator.
-func Equals(x interface{}) Matcher {
- v := reflect.ValueOf(x)
-
- // This matcher doesn't support structs.
- if v.Kind() == reflect.Struct {
- panic(fmt.Sprintf("oglematchers.Equals: unsupported kind %v", v.Kind()))
- }
-
- // The == operator is not defined for non-nil slices.
- if v.Kind() == reflect.Slice && v.Pointer() != uintptr(0) {
- panic(fmt.Sprintf("oglematchers.Equals: non-nil slice"))
- }
-
- return &equalsMatcher{v}
-}
-
-type equalsMatcher struct {
- expectedValue reflect.Value
-}
-
-////////////////////////////////////////////////////////////////////////
-// Numeric types
-////////////////////////////////////////////////////////////////////////
-
-func isSignedInteger(v reflect.Value) bool {
- k := v.Kind()
- return k >= reflect.Int && k <= reflect.Int64
-}
-
-func isUnsignedInteger(v reflect.Value) bool {
- k := v.Kind()
- return k >= reflect.Uint && k <= reflect.Uintptr
-}
-
-func isInteger(v reflect.Value) bool {
- return isSignedInteger(v) || isUnsignedInteger(v)
-}
-
-func isFloat(v reflect.Value) bool {
- k := v.Kind()
- return k == reflect.Float32 || k == reflect.Float64
-}
-
-func isComplex(v reflect.Value) bool {
- k := v.Kind()
- return k == reflect.Complex64 || k == reflect.Complex128
-}
-
-func checkAgainstInt64(e int64, c reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(c):
- if c.Int() == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- u := c.Uint()
- if u <= math.MaxInt64 && int64(u) == e {
- err = nil
- }
-
- // Turn around the various floating point types so that the checkAgainst*
- // functions for them can deal with precision issues.
- case isFloat(c), isComplex(c):
- return Equals(c.Interface()).Matches(e)
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstUint64(e uint64, c reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(c):
- i := c.Int()
- if i >= 0 && uint64(i) == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- if c.Uint() == e {
- err = nil
- }
-
- // Turn around the various floating point types so that the checkAgainst*
- // functions for them can deal with precision issues.
- case isFloat(c), isComplex(c):
- return Equals(c.Interface()).Matches(e)
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstFloat32(e float32, c reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(c):
- if float32(c.Int()) == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- if float32(c.Uint()) == e {
- err = nil
- }
-
- case isFloat(c):
- // Compare using float32 to avoid a false sense of precision; otherwise
- // e.g. Equals(float32(0.1)) won't match float32(0.1).
- if float32(c.Float()) == e {
- err = nil
- }
-
- case isComplex(c):
- comp := c.Complex()
- rl := real(comp)
- im := imag(comp)
-
- // Compare using float32 to avoid a false sense of precision; otherwise
- // e.g. Equals(float32(0.1)) won't match (0.1 + 0i).
- if im == 0 && float32(rl) == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstFloat64(e float64, c reflect.Value) (err error) {
- err = errors.New("")
-
- ck := c.Kind()
-
- switch {
- case isSignedInteger(c):
- if float64(c.Int()) == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- if float64(c.Uint()) == e {
- err = nil
- }
-
- // If the actual value is lower precision, turn the comparison around so we
- // apply the low-precision rules. Otherwise, e.g. Equals(0.1) may not match
- // float32(0.1).
- case ck == reflect.Float32 || ck == reflect.Complex64:
- return Equals(c.Interface()).Matches(e)
-
- // Otherwise, compare with double precision.
- case isFloat(c):
- if c.Float() == e {
- err = nil
- }
-
- case isComplex(c):
- comp := c.Complex()
- rl := real(comp)
- im := imag(comp)
-
- if im == 0 && rl == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstComplex64(e complex64, c reflect.Value) (err error) {
- err = errors.New("")
- realPart := real(e)
- imaginaryPart := imag(e)
-
- switch {
- case isInteger(c) || isFloat(c):
- // If we have no imaginary part, then we should just compare against the
- // real part. Otherwise, we can't be equal.
- if imaginaryPart != 0 {
- return
- }
-
- return checkAgainstFloat32(realPart, c)
-
- case isComplex(c):
- // Compare using complex64 to avoid a false sense of precision; otherwise
- // e.g. Equals(0.1 + 0i) won't match float32(0.1).
- if complex64(c.Complex()) == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstComplex128(e complex128, c reflect.Value) (err error) {
- err = errors.New("")
- realPart := real(e)
- imaginaryPart := imag(e)
-
- switch {
- case isInteger(c) || isFloat(c):
- // If we have no imaginary part, then we should just compare against the
- // real part. Otherwise, we can't be equal.
- if imaginaryPart != 0 {
- return
- }
-
- return checkAgainstFloat64(realPart, c)
-
- case isComplex(c):
- if c.Complex() == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-////////////////////////////////////////////////////////////////////////
-// Other types
-////////////////////////////////////////////////////////////////////////
-
-func checkAgainstBool(e bool, c reflect.Value) (err error) {
- if c.Kind() != reflect.Bool {
- err = NewFatalError("which is not a bool")
- return
- }
-
- err = errors.New("")
- if c.Bool() == e {
- err = nil
- }
- return
-}
-
-func checkAgainstChan(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "chan int".
- typeStr := fmt.Sprintf("%s %s", e.Type().ChanDir(), e.Type().Elem())
-
- // Make sure c is a chan of the correct type.
- if c.Kind() != reflect.Chan ||
- c.Type().ChanDir() != e.Type().ChanDir() ||
- c.Type().Elem() != e.Type().Elem() {
- err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr))
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstFunc(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a function.
- if c.Kind() != reflect.Func {
- err = NewFatalError("which is not a function")
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstMap(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a map.
- if c.Kind() != reflect.Map {
- err = NewFatalError("which is not a map")
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstPtr(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "*int".
- typeStr := fmt.Sprintf("*%v", e.Type().Elem())
-
- // Make sure c is a pointer of the correct type.
- if c.Kind() != reflect.Ptr ||
- c.Type().Elem() != e.Type().Elem() {
- err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr))
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstSlice(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "[]int".
- typeStr := fmt.Sprintf("[]%v", e.Type().Elem())
-
- // Make sure c is a slice of the correct type.
- if c.Kind() != reflect.Slice ||
- c.Type().Elem() != e.Type().Elem() {
- err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr))
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstString(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a string.
- if c.Kind() != reflect.String {
- err = NewFatalError("which is not a string")
- return
- }
-
- err = errors.New("")
- if c.String() == e.String() {
- err = nil
- }
- return
-}
-
-func checkAgainstArray(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "[2]int".
- typeStr := fmt.Sprintf("%v", e.Type())
-
- // Make sure c is the correct type.
- if c.Type() != e.Type() {
- err = NewFatalError(fmt.Sprintf("which is not %s", typeStr))
- return
- }
-
- // Check for equality.
- if e.Interface() != c.Interface() {
- err = errors.New("")
- return
- }
-
- return
-}
-
-func checkAgainstUnsafePointer(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a pointer.
- if c.Kind() != reflect.UnsafePointer {
- err = NewFatalError("which is not a unsafe.Pointer")
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkForNil(c reflect.Value) (err error) {
- err = errors.New("")
-
- // Make sure it is legal to call IsNil.
- switch c.Kind() {
- case reflect.Invalid:
- case reflect.Chan:
- case reflect.Func:
- case reflect.Interface:
- case reflect.Map:
- case reflect.Ptr:
- case reflect.Slice:
-
- default:
- err = NewFatalError("which cannot be compared to nil")
- return
- }
-
- // Ask whether the value is nil. Handle a nil literal (kind Invalid)
- // specially, since it's not legal to call IsNil there.
- if c.Kind() == reflect.Invalid || c.IsNil() {
- err = nil
- }
- return
-}
-
-////////////////////////////////////////////////////////////////////////
-// Public implementation
-////////////////////////////////////////////////////////////////////////
-
-func (m *equalsMatcher) Matches(candidate interface{}) error {
- e := m.expectedValue
- c := reflect.ValueOf(candidate)
- ek := e.Kind()
-
- switch {
- case ek == reflect.Bool:
- return checkAgainstBool(e.Bool(), c)
-
- case isSignedInteger(e):
- return checkAgainstInt64(e.Int(), c)
-
- case isUnsignedInteger(e):
- return checkAgainstUint64(e.Uint(), c)
-
- case ek == reflect.Float32:
- return checkAgainstFloat32(float32(e.Float()), c)
-
- case ek == reflect.Float64:
- return checkAgainstFloat64(e.Float(), c)
-
- case ek == reflect.Complex64:
- return checkAgainstComplex64(complex64(e.Complex()), c)
-
- case ek == reflect.Complex128:
- return checkAgainstComplex128(complex128(e.Complex()), c)
-
- case ek == reflect.Chan:
- return checkAgainstChan(e, c)
-
- case ek == reflect.Func:
- return checkAgainstFunc(e, c)
-
- case ek == reflect.Map:
- return checkAgainstMap(e, c)
-
- case ek == reflect.Ptr:
- return checkAgainstPtr(e, c)
-
- case ek == reflect.Slice:
- return checkAgainstSlice(e, c)
-
- case ek == reflect.String:
- return checkAgainstString(e, c)
-
- case ek == reflect.Array:
- return checkAgainstArray(e, c)
-
- case ek == reflect.UnsafePointer:
- return checkAgainstUnsafePointer(e, c)
-
- case ek == reflect.Invalid:
- return checkForNil(c)
- }
-
- panic(fmt.Sprintf("equalsMatcher.Matches: unexpected kind: %v", ek))
-}
-
-func (m *equalsMatcher) Description() string {
- // Special case: handle nil.
- if !m.expectedValue.IsValid() {
- return "is nil"
- }
-
- return fmt.Sprintf("%v", m.expectedValue.Interface())
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go
deleted file mode 100644
index 4b9d103a..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// GreaterOrEqual returns a matcher that matches integer, floating point, or
-// strings values v such that v >= x. Comparison is not defined between numeric
-// and string types, but is defined between all integer and floating point
-// types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// GreaterOrEqual will panic.
-func GreaterOrEqual(x interface{}) Matcher {
- desc := fmt.Sprintf("greater than or equal to %v", x)
-
- // Special case: make it clear that strings are strings.
- if reflect.TypeOf(x).Kind() == reflect.String {
- desc = fmt.Sprintf("greater than or equal to \"%s\"", x)
- }
-
- return transformDescription(Not(LessThan(x)), desc)
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go
deleted file mode 100644
index 3eef3217..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// GreaterThan returns a matcher that matches integer, floating point, or
-// strings values v such that v > x. Comparison is not defined between numeric
-// and string types, but is defined between all integer and floating point
-// types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// GreaterThan will panic.
-func GreaterThan(x interface{}) Matcher {
- desc := fmt.Sprintf("greater than %v", x)
-
- // Special case: make it clear that strings are strings.
- if reflect.TypeOf(x).Kind() == reflect.String {
- desc = fmt.Sprintf("greater than \"%s\"", x)
- }
-
- return transformDescription(Not(LessOrEqual(x)), desc)
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go
deleted file mode 100644
index 8402cdea..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// LessOrEqual returns a matcher that matches integer, floating point, or
-// strings values v such that v <= x. Comparison is not defined between numeric
-// and string types, but is defined between all integer and floating point
-// types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// LessOrEqual will panic.
-func LessOrEqual(x interface{}) Matcher {
- desc := fmt.Sprintf("less than or equal to %v", x)
-
- // Special case: make it clear that strings are strings.
- if reflect.TypeOf(x).Kind() == reflect.String {
- desc = fmt.Sprintf("less than or equal to \"%s\"", x)
- }
-
- // Put LessThan last so that its error messages will be used in the event of
- // failure.
- return transformDescription(AnyOf(Equals(x), LessThan(x)), desc)
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go
deleted file mode 100644
index 8258e45d..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
-)
-
-// LessThan returns a matcher that matches integer, floating point, or strings
-// values v such that v < x. Comparison is not defined between numeric and
-// string types, but is defined between all integer and floating point types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// LessThan will panic.
-func LessThan(x interface{}) Matcher {
- v := reflect.ValueOf(x)
- kind := v.Kind()
-
- switch {
- case isInteger(v):
- case isFloat(v):
- case kind == reflect.String:
-
- default:
- panic(fmt.Sprintf("LessThan: unexpected kind %v", kind))
- }
-
- return &lessThanMatcher{v}
-}
-
-type lessThanMatcher struct {
- limit reflect.Value
-}
-
-func (m *lessThanMatcher) Description() string {
- // Special case: make it clear that strings are strings.
- if m.limit.Kind() == reflect.String {
- return fmt.Sprintf("less than \"%s\"", m.limit.String())
- }
-
- return fmt.Sprintf("less than %v", m.limit.Interface())
-}
-
-func compareIntegers(v1, v2 reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(v1) && isSignedInteger(v2):
- if v1.Int() < v2.Int() {
- err = nil
- }
- return
-
- case isSignedInteger(v1) && isUnsignedInteger(v2):
- if v1.Int() < 0 || uint64(v1.Int()) < v2.Uint() {
- err = nil
- }
- return
-
- case isUnsignedInteger(v1) && isSignedInteger(v2):
- if v1.Uint() <= math.MaxInt64 && int64(v1.Uint()) < v2.Int() {
- err = nil
- }
- return
-
- case isUnsignedInteger(v1) && isUnsignedInteger(v2):
- if v1.Uint() < v2.Uint() {
- err = nil
- }
- return
- }
-
- panic(fmt.Sprintf("compareIntegers: %v %v", v1, v2))
-}
-
-func getFloat(v reflect.Value) float64 {
- switch {
- case isSignedInteger(v):
- return float64(v.Int())
-
- case isUnsignedInteger(v):
- return float64(v.Uint())
-
- case isFloat(v):
- return v.Float()
- }
-
- panic(fmt.Sprintf("getFloat: %v", v))
-}
-
-func (m *lessThanMatcher) Matches(c interface{}) (err error) {
- v1 := reflect.ValueOf(c)
- v2 := m.limit
-
- err = errors.New("")
-
- // Handle strings as a special case.
- if v1.Kind() == reflect.String && v2.Kind() == reflect.String {
- if v1.String() < v2.String() {
- err = nil
- }
- return
- }
-
- // If we get here, we require that we are dealing with integers or floats.
- v1Legal := isInteger(v1) || isFloat(v1)
- v2Legal := isInteger(v2) || isFloat(v2)
- if !v1Legal || !v2Legal {
- err = NewFatalError("which is not comparable")
- return
- }
-
- // Handle the various comparison cases.
- switch {
- // Both integers
- case isInteger(v1) && isInteger(v2):
- return compareIntegers(v1, v2)
-
- // At least one float32
- case v1.Kind() == reflect.Float32 || v2.Kind() == reflect.Float32:
- if float32(getFloat(v1)) < float32(getFloat(v2)) {
- err = nil
- }
- return
-
- // At least one float64
- case v1.Kind() == reflect.Float64 || v2.Kind() == reflect.Float64:
- if getFloat(v1) < getFloat(v2) {
- err = nil
- }
- return
- }
-
- // We shouldn't get here.
- panic(fmt.Sprintf("lessThanMatcher.Matches: Shouldn't get here: %v %v", v1, v2))
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go
deleted file mode 100644
index 78159a07..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package oglematchers provides a set of matchers useful in a testing or
-// mocking framework. These matchers are inspired by and mostly compatible with
-// Google Test for C++ and Google JS Test.
-//
-// This package is used by github.com/smartystreets/assertions/internal/ogletest and
-// github.com/smartystreets/assertions/internal/oglemock, which may be more directly useful if you're not
-// writing your own testing package or defining your own matchers.
-package oglematchers
-
-// A Matcher is some predicate implicitly defining a set of values that it
-// matches. For example, GreaterThan(17) matches all numeric values greater
-// than 17, and HasSubstr("taco") matches all strings with the substring
-// "taco".
-//
-// Matchers are typically exposed to tests via constructor functions like
-// HasSubstr. In order to implement such a function you can either define your
-// own matcher type or use NewMatcher.
-type Matcher interface {
- // Check whether the supplied value belongs to the the set defined by the
- // matcher. Return a non-nil error if and only if it does not.
- //
- // The error describes why the value doesn't match. The error text is a
- // relative clause that is suitable for being placed after the value. For
- // example, a predicate that matches strings with a particular substring may,
- // when presented with a numerical value, return the following error text:
- //
- // "which is not a string"
- //
- // Then the failure message may look like:
- //
- // Expected: has substring "taco"
- // Actual: 17, which is not a string
- //
- // If the error is self-apparent based on the description of the matcher, the
- // error text may be empty (but the error still non-nil). For example:
- //
- // Expected: 17
- // Actual: 19
- //
- // If you are implementing a new matcher, see also the documentation on
- // FatalError.
- Matches(candidate interface{}) error
-
- // Description returns a string describing the property that values matching
- // this matcher have, as a verb phrase where the subject is the value. For
- // example, "is greather than 17" or "has substring "taco"".
- Description() string
-}
-
-// FatalError is an implementation of the error interface that may be returned
-// from matchers, indicating the error should be propagated. Returning a
-// *FatalError indicates that the matcher doesn't process values of the
-// supplied type, or otherwise doesn't know how to handle the value.
-//
-// For example, if GreaterThan(17) returned false for the value "taco" without
-// a fatal error, then Not(GreaterThan(17)) would return true. This is
-// technically correct, but is surprising and may mask failures where the wrong
-// sort of matcher is accidentally used. Instead, GreaterThan(17) can return a
-// fatal error, which will be propagated by Not().
-type FatalError struct {
- errorText string
-}
-
-// NewFatalError creates a FatalError struct with the supplied error text.
-func NewFatalError(s string) *FatalError {
- return &FatalError{s}
-}
-
-func (e *FatalError) Error() string {
- return e.errorText
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go
deleted file mode 100644
index 623789fe..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
-)
-
-// Not returns a matcher that inverts the set of values matched by the wrapped
-// matcher. It does not transform the result for values for which the wrapped
-// matcher returns a fatal error.
-func Not(m Matcher) Matcher {
- return &notMatcher{m}
-}
-
-type notMatcher struct {
- wrapped Matcher
-}
-
-func (m *notMatcher) Matches(c interface{}) (err error) {
- err = m.wrapped.Matches(c)
-
- // Did the wrapped matcher say yes?
- if err == nil {
- return errors.New("")
- }
-
- // Did the wrapped matcher return a fatal error?
- if _, isFatal := err.(*FatalError); isFatal {
- return err
- }
-
- // The wrapped matcher returned a non-fatal error.
- return nil
-}
-
-func (m *notMatcher) Description() string {
- return fmt.Sprintf("not(%s)", m.wrapped.Description())
-}
diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go b/vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go
deleted file mode 100644
index 8ea2807c..00000000
--- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-// transformDescription returns a matcher that is equivalent to the supplied
-// one, except that it has the supplied description instead of the one attached
-// to the existing matcher.
-func transformDescription(m Matcher, newDesc string) Matcher {
- return &transformDescriptionMatcher{newDesc, m}
-}
-
-type transformDescriptionMatcher struct {
- desc string
- wrappedMatcher Matcher
-}
-
-func (m *transformDescriptionMatcher) Description() string {
- return m.desc
-}
-
-func (m *transformDescriptionMatcher) Matches(c interface{}) error {
- return m.wrappedMatcher.Matches(c)
-}
diff --git a/vendor/github.com/smartystreets/assertions/messages.go b/vendor/github.com/smartystreets/assertions/messages.go
deleted file mode 100644
index 72782b00..00000000
--- a/vendor/github.com/smartystreets/assertions/messages.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package assertions
-
-const (
- shouldHaveBeenEqual = "Expected: '%v'\nActual: '%v'\n(Should be equal)"
- shouldHaveBeenEqualNoResemblance = "Both the actual and expected values render equally ('%s') and their types are the same. Try using ShouldResemble instead."
- shouldNotHaveBeenEqual = "Expected '%v'\nto NOT equal '%v'\n(but it did)!"
- shouldHaveBeenEqualTypeMismatch = "Expected: '%v' (%T)\nActual: '%v' (%T)\n(Should be equal, type mismatch)"
-
- shouldHaveBeenAlmostEqual = "Expected '%v' to almost equal '%v' (but it didn't)!"
- shouldHaveNotBeenAlmostEqual = "Expected '%v' to NOT almost equal '%v' (but it did)!"
-
- shouldHaveResembled = "Expected: '%s'\nActual: '%s'\n(Should resemble)!"
- shouldNotHaveResembled = "Expected '%#v'\nto NOT resemble '%#v'\n(but it did)!"
-
- shouldBePointers = "Both arguments should be pointers "
- shouldHaveBeenNonNilPointer = shouldBePointers + "(the %s was %s)!"
- shouldHavePointedTo = "Expected '%+v' (address: '%v') and '%+v' (address: '%v') to be the same address (but their weren't)!"
- shouldNotHavePointedTo = "Expected '%+v' and '%+v' to be different references (but they matched: '%v')!"
-
- shouldHaveBeenNil = "Expected: nil\nActual: '%v'"
- shouldNotHaveBeenNil = "Expected '%+v' to NOT be nil (but it was)!"
-
- shouldHaveBeenTrue = "Expected: true\nActual: %v"
- shouldHaveBeenFalse = "Expected: false\nActual: %v"
-
- shouldHaveBeenZeroValue = "'%+v' should have been the zero value" //"Expected: (zero value)\nActual: %v"
- shouldNotHaveBeenZeroValue = "'%+v' should NOT have been the zero value"
-
- shouldHaveBeenGreater = "Expected '%v' to be greater than '%v' (but it wasn't)!"
- shouldHaveBeenGreaterOrEqual = "Expected '%v' to be greater than or equal to '%v' (but it wasn't)!"
-
- shouldHaveBeenLess = "Expected '%v' to be less than '%v' (but it wasn't)!"
- shouldHaveBeenLessOrEqual = "Expected '%v' to be less than or equal to '%v' (but it wasn't)!"
-
- shouldHaveBeenBetween = "Expected '%v' to be between '%v' and '%v' (but it wasn't)!"
- shouldNotHaveBeenBetween = "Expected '%v' NOT to be between '%v' and '%v' (but it was)!"
- shouldHaveDifferentUpperAndLower = "The lower and upper bounds must be different values (they were both '%v')."
-
- shouldHaveBeenBetweenOrEqual = "Expected '%v' to be between '%v' and '%v' or equal to one of them (but it wasn't)!"
- shouldNotHaveBeenBetweenOrEqual = "Expected '%v' NOT to be between '%v' and '%v' or equal to one of them (but it was)!"
-
- shouldHaveContained = "Expected the container (%v) to contain: '%v' (but it didn't)!"
- shouldNotHaveContained = "Expected the container (%v) NOT to contain: '%v' (but it did)!"
- shouldHaveBeenAValidCollection = "You must provide a valid container (was %v)!"
-
- shouldHaveContainedKey = "Expected the %v to contain the key: %v (but it didn't)!"
- shouldNotHaveContainedKey = "Expected the %v NOT to contain the key: %v (but it did)!"
- shouldHaveBeenAValidMap = "You must provide a valid map type (was %v)!"
-
- shouldHaveBeenIn = "Expected '%v' to be in the container (%v), but it wasn't!"
- shouldNotHaveBeenIn = "Expected '%v' NOT to be in the container (%v), but it was!"
-
- shouldHaveBeenEmpty = "Expected %+v to be empty (but it wasn't)!"
- shouldNotHaveBeenEmpty = "Expected %+v to NOT be empty (but it was)!"
-
- shouldHaveBeenAValidInteger = "You must provide a valid integer (was %v)!"
- shouldHaveBeenAValidLength = "You must provide a valid positive integer (was %v)!"
- shouldHaveHadLength = "Expected collection to have length equal to [%v], but it's length was [%v] instead! contents: %+v"
-
- shouldHaveStartedWith = "Expected '%v'\nto start with '%v'\n(but it didn't)!"
- shouldNotHaveStartedWith = "Expected '%v'\nNOT to start with '%v'\n(but it did)!"
-
- shouldHaveEndedWith = "Expected '%v'\nto end with '%v'\n(but it didn't)!"
- shouldNotHaveEndedWith = "Expected '%v'\nNOT to end with '%v'\n(but it did)!"
-
- shouldAllBeStrings = "All arguments to this assertion must be strings (you provided: %v)."
- shouldBothBeStrings = "Both arguments to this assertion must be strings (you provided %v and %v)."
-
- shouldHaveContainedSubstring = "Expected '%s' to contain substring '%s' (but it didn't)!"
- shouldNotHaveContainedSubstring = "Expected '%s' NOT to contain substring '%s' (but it did)!"
-
- shouldBeString = "The argument to this assertion must be a string (you provided %v)."
- shouldHaveBeenBlank = "Expected '%s' to be blank (but it wasn't)!"
- shouldNotHaveBeenBlank = "Expected value to NOT be blank (but it was)!"
-
- shouldUseVoidNiladicFunction = "You must provide a void, niladic function as the first argument!"
- shouldHavePanicked = "Expected func() to panic (but it didn't)!"
- shouldNotHavePanicked = "Expected func() NOT to panic (error: '%+v')!"
-
- shouldHavePanickedWith = "Expected func() to panic with '%v' (but it panicked with '%v')!"
- shouldNotHavePanickedWith = "Expected func() NOT to panic with '%v' (but it did)!"
-
- shouldHaveBeenA = "Expected '%v' to be: '%v' (but was: '%v')!"
- shouldNotHaveBeenA = "Expected '%v' to NOT be: '%v' (but it was)!"
-
- shouldHaveImplemented = "Expected: '%v interface support'\nActual: '%v' does not implement the interface!"
- shouldNotHaveImplemented = "Expected '%v'\nto NOT implement '%v'\n(but it did)!"
- shouldCompareWithInterfacePointer = "The expected value must be a pointer to an interface type (eg. *fmt.Stringer)"
- shouldNotBeNilActual = "The actual value was 'nil' and should be a value or a pointer to a value!"
-
- shouldBeError = "Expected an error value (but was '%v' instead)!"
- shouldBeErrorInvalidComparisonValue = "The final argument to this assertion must be a string or an error value (you provided: '%v')."
-
- shouldUseTimes = "You must provide time instances as arguments to this assertion."
- shouldUseTimeSlice = "You must provide a slice of time instances as the first argument to this assertion."
- shouldUseDurationAndTime = "You must provide a duration and a time as arguments to this assertion."
-
- shouldHaveHappenedBefore = "Expected '%v' to happen before '%v' (it happened '%v' after)!"
- shouldHaveHappenedAfter = "Expected '%v' to happen after '%v' (it happened '%v' before)!"
- shouldHaveHappenedBetween = "Expected '%v' to happen between '%v' and '%v' (it happened '%v' outside threshold)!"
- shouldNotHaveHappenedOnOrBetween = "Expected '%v' to NOT happen on or between '%v' and '%v' (but it did)!"
-
- // format params: incorrect-index, previous-index, previous-time, incorrect-index, incorrect-time
- shouldHaveBeenChronological = "The 'Time' at index [%d] should have happened after the previous one (but it didn't!):\n [%d]: %s\n [%d]: %s (see, it happened before!)"
- shouldNotHaveBeenchronological = "The provided times should NOT be chronological, but they were."
-)
diff --git a/vendor/github.com/smartystreets/assertions/panic.go b/vendor/github.com/smartystreets/assertions/panic.go
deleted file mode 100644
index 7e75db17..00000000
--- a/vendor/github.com/smartystreets/assertions/panic.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package assertions
-
-import "fmt"
-
-// ShouldPanic receives a void, niladic function and expects to recover a panic.
-func ShouldPanic(actual interface{}, expected ...interface{}) (message string) {
- if fail := need(0, expected); fail != success {
- return fail
- }
-
- action, _ := actual.(func())
-
- if action == nil {
- message = shouldUseVoidNiladicFunction
- return
- }
-
- defer func() {
- recovered := recover()
- if recovered == nil {
- message = shouldHavePanicked
- } else {
- message = success
- }
- }()
- action()
-
- return
-}
-
-// ShouldNotPanic receives a void, niladic function and expects to execute the function without any panic.
-func ShouldNotPanic(actual interface{}, expected ...interface{}) (message string) {
- if fail := need(0, expected); fail != success {
- return fail
- }
-
- action, _ := actual.(func())
-
- if action == nil {
- message = shouldUseVoidNiladicFunction
- return
- }
-
- defer func() {
- recovered := recover()
- if recovered != nil {
- message = fmt.Sprintf(shouldNotHavePanicked, recovered)
- } else {
- message = success
- }
- }()
- action()
-
- return
-}
-
-// ShouldPanicWith receives a void, niladic function and expects to recover a panic with the second argument as the content.
-func ShouldPanicWith(actual interface{}, expected ...interface{}) (message string) {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- action, _ := actual.(func())
-
- if action == nil {
- message = shouldUseVoidNiladicFunction
- return
- }
-
- defer func() {
- recovered := recover()
- if recovered == nil {
- message = shouldHavePanicked
- } else {
- if equal := ShouldEqual(recovered, expected[0]); equal != success {
- message = serializer.serialize(expected[0], recovered, fmt.Sprintf(shouldHavePanickedWith, expected[0], recovered))
- } else {
- message = success
- }
- }
- }()
- action()
-
- return
-}
-
-// ShouldNotPanicWith receives a void, niladic function and expects to recover a panic whose content differs from the second argument.
-func ShouldNotPanicWith(actual interface{}, expected ...interface{}) (message string) {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- action, _ := actual.(func())
-
- if action == nil {
- message = shouldUseVoidNiladicFunction
- return
- }
-
- defer func() {
- recovered := recover()
- if recovered == nil {
- message = success
- } else {
- if equal := ShouldEqual(recovered, expected[0]); equal == success {
- message = fmt.Sprintf(shouldNotHavePanickedWith, expected[0])
- } else {
- message = success
- }
- }
- }()
- action()
-
- return
-}
diff --git a/vendor/github.com/smartystreets/assertions/quantity.go b/vendor/github.com/smartystreets/assertions/quantity.go
deleted file mode 100644
index f28b0a06..00000000
--- a/vendor/github.com/smartystreets/assertions/quantity.go
+++ /dev/null
@@ -1,141 +0,0 @@
-package assertions
-
-import (
- "fmt"
-
- "github.com/smartystreets/assertions/internal/oglematchers"
-)
-
-// ShouldBeGreaterThan receives exactly two parameters and ensures that the first is greater than the second.
-func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- if matchError := oglematchers.GreaterThan(expected[0]).Matches(actual); matchError != nil {
- return fmt.Sprintf(shouldHaveBeenGreater, actual, expected[0])
- }
- return success
-}
-
-// ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that the first is greater than or equal to the second.
-func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- } else if matchError := oglematchers.GreaterOrEqual(expected[0]).Matches(actual); matchError != nil {
- return fmt.Sprintf(shouldHaveBeenGreaterOrEqual, actual, expected[0])
- }
- return success
-}
-
-// ShouldBeLessThan receives exactly two parameters and ensures that the first is less than the second.
-func ShouldBeLessThan(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- } else if matchError := oglematchers.LessThan(expected[0]).Matches(actual); matchError != nil {
- return fmt.Sprintf(shouldHaveBeenLess, actual, expected[0])
- }
- return success
-}
-
-// ShouldBeLessThan receives exactly two parameters and ensures that the first is less than or equal to the second.
-func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- } else if matchError := oglematchers.LessOrEqual(expected[0]).Matches(actual); matchError != nil {
- return fmt.Sprintf(shouldHaveBeenLessOrEqual, actual, expected[0])
- }
- return success
-}
-
-// ShouldBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound.
-// It ensures that the actual value is between both bounds (but not equal to either of them).
-func ShouldBeBetween(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- lower, upper, fail := deriveBounds(expected)
-
- if fail != success {
- return fail
- } else if !isBetween(actual, lower, upper) {
- return fmt.Sprintf(shouldHaveBeenBetween, actual, lower, upper)
- }
- return success
-}
-
-// ShouldNotBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound.
-// It ensures that the actual value is NOT between both bounds.
-func ShouldNotBeBetween(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- lower, upper, fail := deriveBounds(expected)
-
- if fail != success {
- return fail
- } else if isBetween(actual, lower, upper) {
- return fmt.Sprintf(shouldNotHaveBeenBetween, actual, lower, upper)
- }
- return success
-}
-func deriveBounds(values []interface{}) (lower interface{}, upper interface{}, fail string) {
- lower = values[0]
- upper = values[1]
-
- if ShouldNotEqual(lower, upper) != success {
- return nil, nil, fmt.Sprintf(shouldHaveDifferentUpperAndLower, lower)
- } else if ShouldBeLessThan(lower, upper) != success {
- lower, upper = upper, lower
- }
- return lower, upper, success
-}
-func isBetween(value, lower, upper interface{}) bool {
- if ShouldBeGreaterThan(value, lower) != success {
- return false
- } else if ShouldBeLessThan(value, upper) != success {
- return false
- }
- return true
-}
-
-// ShouldBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound.
-// It ensures that the actual value is between both bounds or equal to one of them.
-func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- lower, upper, fail := deriveBounds(expected)
-
- if fail != success {
- return fail
- } else if !isBetweenOrEqual(actual, lower, upper) {
- return fmt.Sprintf(shouldHaveBeenBetweenOrEqual, actual, lower, upper)
- }
- return success
-}
-
-// ShouldNotBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound.
-// It ensures that the actual value is nopt between the bounds nor equal to either of them.
-func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- lower, upper, fail := deriveBounds(expected)
-
- if fail != success {
- return fail
- } else if isBetweenOrEqual(actual, lower, upper) {
- return fmt.Sprintf(shouldNotHaveBeenBetweenOrEqual, actual, lower, upper)
- }
- return success
-}
-
-func isBetweenOrEqual(value, lower, upper interface{}) bool {
- if ShouldBeGreaterThanOrEqualTo(value, lower) != success {
- return false
- } else if ShouldBeLessThanOrEqualTo(value, upper) != success {
- return false
- }
- return true
-}
diff --git a/vendor/github.com/smartystreets/assertions/serializer.go b/vendor/github.com/smartystreets/assertions/serializer.go
deleted file mode 100644
index f1e3570e..00000000
--- a/vendor/github.com/smartystreets/assertions/serializer.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package assertions
-
-import (
- "encoding/json"
- "fmt"
- "strings"
-
- "github.com/smartystreets/assertions/internal/go-render/render"
-)
-
-type Serializer interface {
- serialize(expected, actual interface{}, message string) string
- serializeDetailed(expected, actual interface{}, message string) string
-}
-
-type failureSerializer struct{}
-
-func (self *failureSerializer) serializeDetailed(expected, actual interface{}, message string) string {
- if index := strings.Index(message, " Diff:"); index > 0 {
- message = message[:index]
- }
- view := FailureView{
- Message: message,
- Expected: render.Render(expected),
- Actual: render.Render(actual),
- }
- serialized, _ := json.Marshal(view)
- return string(serialized)
-}
-
-func (self *failureSerializer) serialize(expected, actual interface{}, message string) string {
- if index := strings.Index(message, " Diff:"); index > 0 {
- message = message[:index]
- }
- view := FailureView{
- Message: message,
- Expected: fmt.Sprintf("%+v", expected),
- Actual: fmt.Sprintf("%+v", actual),
- }
- serialized, _ := json.Marshal(view)
- return string(serialized)
-}
-
-func newSerializer() *failureSerializer {
- return &failureSerializer{}
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-// This struct is also declared in github.com/smartystreets/goconvey/convey/reporting.
-// The json struct tags should be equal in both declarations.
-type FailureView struct {
- Message string `json:"Message"`
- Expected string `json:"Expected"`
- Actual string `json:"Actual"`
-}
-
-///////////////////////////////////////////////////////
-
-// noopSerializer just gives back the original message. This is useful when we are using
-// the assertions from a context other than the GoConvey Web UI, that requires the JSON
-// structure provided by the failureSerializer.
-type noopSerializer struct{}
-
-func (self *noopSerializer) serialize(expected, actual interface{}, message string) string {
- return message
-}
-func (self *noopSerializer) serializeDetailed(expected, actual interface{}, message string) string {
- return message
-}
diff --git a/vendor/github.com/smartystreets/assertions/strings.go b/vendor/github.com/smartystreets/assertions/strings.go
deleted file mode 100644
index dbc3f047..00000000
--- a/vendor/github.com/smartystreets/assertions/strings.go
+++ /dev/null
@@ -1,227 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "reflect"
- "strings"
-)
-
-// ShouldStartWith receives exactly 2 string parameters and ensures that the first starts with the second.
-func ShouldStartWith(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- value, valueIsString := actual.(string)
- prefix, prefixIsString := expected[0].(string)
-
- if !valueIsString || !prefixIsString {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- return shouldStartWith(value, prefix)
-}
-func shouldStartWith(value, prefix string) string {
- if !strings.HasPrefix(value, prefix) {
- shortval := value
- if len(shortval) > len(prefix) {
- shortval = shortval[:len(prefix)] + "..."
- }
- return serializer.serialize(prefix, shortval, fmt.Sprintf(shouldHaveStartedWith, value, prefix))
- }
- return success
-}
-
-// ShouldNotStartWith receives exactly 2 string parameters and ensures that the first does not start with the second.
-func ShouldNotStartWith(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- value, valueIsString := actual.(string)
- prefix, prefixIsString := expected[0].(string)
-
- if !valueIsString || !prefixIsString {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- return shouldNotStartWith(value, prefix)
-}
-func shouldNotStartWith(value, prefix string) string {
- if strings.HasPrefix(value, prefix) {
- if value == "" {
- value = "<empty>"
- }
- if prefix == "" {
- prefix = "<empty>"
- }
- return fmt.Sprintf(shouldNotHaveStartedWith, value, prefix)
- }
- return success
-}
-
-// ShouldEndWith receives exactly 2 string parameters and ensures that the first ends with the second.
-func ShouldEndWith(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- value, valueIsString := actual.(string)
- suffix, suffixIsString := expected[0].(string)
-
- if !valueIsString || !suffixIsString {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- return shouldEndWith(value, suffix)
-}
-func shouldEndWith(value, suffix string) string {
- if !strings.HasSuffix(value, suffix) {
- shortval := value
- if len(shortval) > len(suffix) {
- shortval = "..." + shortval[len(shortval)-len(suffix):]
- }
- return serializer.serialize(suffix, shortval, fmt.Sprintf(shouldHaveEndedWith, value, suffix))
- }
- return success
-}
-
-// ShouldEndWith receives exactly 2 string parameters and ensures that the first does not end with the second.
-func ShouldNotEndWith(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- value, valueIsString := actual.(string)
- suffix, suffixIsString := expected[0].(string)
-
- if !valueIsString || !suffixIsString {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- return shouldNotEndWith(value, suffix)
-}
-func shouldNotEndWith(value, suffix string) string {
- if strings.HasSuffix(value, suffix) {
- if value == "" {
- value = "<empty>"
- }
- if suffix == "" {
- suffix = "<empty>"
- }
- return fmt.Sprintf(shouldNotHaveEndedWith, value, suffix)
- }
- return success
-}
-
-// ShouldContainSubstring receives exactly 2 string parameters and ensures that the first contains the second as a substring.
-func ShouldContainSubstring(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- long, longOk := actual.(string)
- short, shortOk := expected[0].(string)
-
- if !longOk || !shortOk {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- if !strings.Contains(long, short) {
- return serializer.serialize(expected[0], actual, fmt.Sprintf(shouldHaveContainedSubstring, long, short))
- }
- return success
-}
-
-// ShouldNotContainSubstring receives exactly 2 string parameters and ensures that the first does NOT contain the second as a substring.
-func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- long, longOk := actual.(string)
- short, shortOk := expected[0].(string)
-
- if !longOk || !shortOk {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- if strings.Contains(long, short) {
- return fmt.Sprintf(shouldNotHaveContainedSubstring, long, short)
- }
- return success
-}
-
-// ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal to "".
-func ShouldBeBlank(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
- value, ok := actual.(string)
- if !ok {
- return fmt.Sprintf(shouldBeString, reflect.TypeOf(actual))
- }
- if value != "" {
- return serializer.serialize("", value, fmt.Sprintf(shouldHaveBeenBlank, value))
- }
- return success
-}
-
-// ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is equal to "".
-func ShouldNotBeBlank(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
- value, ok := actual.(string)
- if !ok {
- return fmt.Sprintf(shouldBeString, reflect.TypeOf(actual))
- }
- if value == "" {
- return shouldNotHaveBeenBlank
- }
- return success
-}
-
-// ShouldEqualWithout receives exactly 3 string parameters and ensures that the first is equal to the second
-// after removing all instances of the third from the first using strings.Replace(first, third, "", -1).
-func ShouldEqualWithout(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- actualString, ok1 := actual.(string)
- expectedString, ok2 := expected[0].(string)
- replace, ok3 := expected[1].(string)
-
- if !ok1 || !ok2 || !ok3 {
- return fmt.Sprintf(shouldAllBeStrings, []reflect.Type{
- reflect.TypeOf(actual),
- reflect.TypeOf(expected[0]),
- reflect.TypeOf(expected[1]),
- })
- }
-
- replaced := strings.Replace(actualString, replace, "", -1)
- if replaced == expectedString {
- return ""
- }
-
- return fmt.Sprintf("Expected '%s' to equal '%s' but without any '%s' (but it didn't).", actualString, expectedString, replace)
-}
-
-// ShouldEqualTrimSpace receives exactly 2 string parameters and ensures that the first is equal to the second
-// after removing all leading and trailing whitespace using strings.TrimSpace(first).
-func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- actualString, valueIsString := actual.(string)
- _, value2IsString := expected[0].(string)
-
- if !valueIsString || !value2IsString {
- return fmt.Sprintf(shouldBothBeStrings, reflect.TypeOf(actual), reflect.TypeOf(expected[0]))
- }
-
- actualString = strings.TrimSpace(actualString)
- return ShouldEqual(actualString, expected[0])
-}
diff --git a/vendor/github.com/smartystreets/assertions/time.go b/vendor/github.com/smartystreets/assertions/time.go
deleted file mode 100644
index 918ee284..00000000
--- a/vendor/github.com/smartystreets/assertions/time.go
+++ /dev/null
@@ -1,218 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "time"
-)
-
-// ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the first happens before the second.
-func ShouldHappenBefore(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- expectedTime, secondOk := expected[0].(time.Time)
-
- if !firstOk || !secondOk {
- return shouldUseTimes
- }
-
- if !actualTime.Before(expectedTime) {
- return fmt.Sprintf(shouldHaveHappenedBefore, actualTime, expectedTime, actualTime.Sub(expectedTime))
- }
-
- return success
-}
-
-// ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that the first happens on or before the second.
-func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- expectedTime, secondOk := expected[0].(time.Time)
-
- if !firstOk || !secondOk {
- return shouldUseTimes
- }
-
- if actualTime.Equal(expectedTime) {
- return success
- }
- return ShouldHappenBefore(actualTime, expectedTime)
-}
-
-// ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the first happens after the second.
-func ShouldHappenAfter(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- expectedTime, secondOk := expected[0].(time.Time)
-
- if !firstOk || !secondOk {
- return shouldUseTimes
- }
- if !actualTime.After(expectedTime) {
- return fmt.Sprintf(shouldHaveHappenedAfter, actualTime, expectedTime, expectedTime.Sub(actualTime))
- }
- return success
-}
-
-// ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that the first happens on or after the second.
-func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- expectedTime, secondOk := expected[0].(time.Time)
-
- if !firstOk || !secondOk {
- return shouldUseTimes
- }
- if actualTime.Equal(expectedTime) {
- return success
- }
- return ShouldHappenAfter(actualTime, expectedTime)
-}
-
-// ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the first happens between (not on) the second and third.
-func ShouldHappenBetween(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- min, secondOk := expected[0].(time.Time)
- max, thirdOk := expected[1].(time.Time)
-
- if !firstOk || !secondOk || !thirdOk {
- return shouldUseTimes
- }
-
- if !actualTime.After(min) {
- return fmt.Sprintf(shouldHaveHappenedBetween, actualTime, min, max, min.Sub(actualTime))
- }
- if !actualTime.Before(max) {
- return fmt.Sprintf(shouldHaveHappenedBetween, actualTime, min, max, actualTime.Sub(max))
- }
- return success
-}
-
-// ShouldHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that the first happens between or on the second and third.
-func ShouldHappenOnOrBetween(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- min, secondOk := expected[0].(time.Time)
- max, thirdOk := expected[1].(time.Time)
-
- if !firstOk || !secondOk || !thirdOk {
- return shouldUseTimes
- }
- if actualTime.Equal(min) || actualTime.Equal(max) {
- return success
- }
- return ShouldHappenBetween(actualTime, min, max)
-}
-
-// ShouldNotHappenOnOrBetween receives exactly 3 time.Time arguments and asserts that the first
-// does NOT happen between or on the second or third.
-func ShouldNotHappenOnOrBetween(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- min, secondOk := expected[0].(time.Time)
- max, thirdOk := expected[1].(time.Time)
-
- if !firstOk || !secondOk || !thirdOk {
- return shouldUseTimes
- }
- if actualTime.Equal(min) || actualTime.Equal(max) {
- return fmt.Sprintf(shouldNotHaveHappenedOnOrBetween, actualTime, min, max)
- }
- if actualTime.After(min) && actualTime.Before(max) {
- return fmt.Sprintf(shouldNotHaveHappenedOnOrBetween, actualTime, min, max)
- }
- return success
-}
-
-// ShouldHappenWithin receives a time.Time, a time.Duration, and a time.Time (3 arguments)
-// and asserts that the first time.Time happens within or on the duration specified relative to
-// the other time.Time.
-func ShouldHappenWithin(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- tolerance, secondOk := expected[0].(time.Duration)
- threshold, thirdOk := expected[1].(time.Time)
-
- if !firstOk || !secondOk || !thirdOk {
- return shouldUseDurationAndTime
- }
-
- min := threshold.Add(-tolerance)
- max := threshold.Add(tolerance)
- return ShouldHappenOnOrBetween(actualTime, min, max)
-}
-
-// ShouldNotHappenWithin receives a time.Time, a time.Duration, and a time.Time (3 arguments)
-// and asserts that the first time.Time does NOT happen within or on the duration specified relative to
-// the other time.Time.
-func ShouldNotHappenWithin(actual interface{}, expected ...interface{}) string {
- if fail := need(2, expected); fail != success {
- return fail
- }
- actualTime, firstOk := actual.(time.Time)
- tolerance, secondOk := expected[0].(time.Duration)
- threshold, thirdOk := expected[1].(time.Time)
-
- if !firstOk || !secondOk || !thirdOk {
- return shouldUseDurationAndTime
- }
-
- min := threshold.Add(-tolerance)
- max := threshold.Add(tolerance)
- return ShouldNotHappenOnOrBetween(actualTime, min, max)
-}
-
-// ShouldBeChronological receives a []time.Time slice and asserts that they are
-// in chronological order starting with the first time.Time as the earliest.
-func ShouldBeChronological(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
-
- times, ok := actual.([]time.Time)
- if !ok {
- return shouldUseTimeSlice
- }
-
- var previous time.Time
- for i, current := range times {
- if i > 0 && current.Before(previous) {
- return fmt.Sprintf(shouldHaveBeenChronological,
- i, i-1, previous.String(), i, current.String())
- }
- previous = current
- }
- return ""
-}
-
-// ShouldNotBeChronological receives a []time.Time slice and asserts that they are
-// NOT in chronological order.
-func ShouldNotBeChronological(actual interface{}, expected ...interface{}) string {
- if fail := need(0, expected); fail != success {
- return fail
- }
- if _, ok := actual.([]time.Time); !ok {
- return shouldUseTimeSlice
- }
- result := ShouldBeChronological(actual, expected...)
- if result != "" {
- return ""
- }
- return shouldNotHaveBeenchronological
-}
diff --git a/vendor/github.com/smartystreets/assertions/type.go b/vendor/github.com/smartystreets/assertions/type.go
deleted file mode 100644
index d2d1dc86..00000000
--- a/vendor/github.com/smartystreets/assertions/type.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "reflect"
-)
-
-// ShouldHaveSameTypeAs receives exactly two parameters and compares their underlying types for equality.
-func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- first := reflect.TypeOf(actual)
- second := reflect.TypeOf(expected[0])
-
- if first != second {
- return serializer.serialize(second, first, fmt.Sprintf(shouldHaveBeenA, actual, second, first))
- }
-
- return success
-}
-
-// ShouldNotHaveSameTypeAs receives exactly two parameters and compares their underlying types for inequality.
-func ShouldNotHaveSameTypeAs(actual interface{}, expected ...interface{}) string {
- if fail := need(1, expected); fail != success {
- return fail
- }
-
- first := reflect.TypeOf(actual)
- second := reflect.TypeOf(expected[0])
-
- if (actual == nil && expected[0] == nil) || first == second {
- return fmt.Sprintf(shouldNotHaveBeenA, actual, second)
- }
- return success
-}
-
-// ShouldImplement receives exactly two parameters and ensures
-// that the first implements the interface type of the second.
-func ShouldImplement(actual interface{}, expectedList ...interface{}) string {
- if fail := need(1, expectedList); fail != success {
- return fail
- }
-
- expected := expectedList[0]
- if fail := ShouldBeNil(expected); fail != success {
- return shouldCompareWithInterfacePointer
- }
-
- if fail := ShouldNotBeNil(actual); fail != success {
- return shouldNotBeNilActual
- }
-
- var actualType reflect.Type
- if reflect.TypeOf(actual).Kind() != reflect.Ptr {
- actualType = reflect.PtrTo(reflect.TypeOf(actual))
- } else {
- actualType = reflect.TypeOf(actual)
- }
-
- expectedType := reflect.TypeOf(expected)
- if fail := ShouldNotBeNil(expectedType); fail != success {
- return shouldCompareWithInterfacePointer
- }
-
- expectedInterface := expectedType.Elem()
-
- if !actualType.Implements(expectedInterface) {
- return fmt.Sprintf(shouldHaveImplemented, expectedInterface, actualType)
- }
- return success
-}
-
-// ShouldNotImplement receives exactly two parameters and ensures
-// that the first does NOT implement the interface type of the second.
-func ShouldNotImplement(actual interface{}, expectedList ...interface{}) string {
- if fail := need(1, expectedList); fail != success {
- return fail
- }
-
- expected := expectedList[0]
- if fail := ShouldBeNil(expected); fail != success {
- return shouldCompareWithInterfacePointer
- }
-
- if fail := ShouldNotBeNil(actual); fail != success {
- return shouldNotBeNilActual
- }
-
- var actualType reflect.Type
- if reflect.TypeOf(actual).Kind() != reflect.Ptr {
- actualType = reflect.PtrTo(reflect.TypeOf(actual))
- } else {
- actualType = reflect.TypeOf(actual)
- }
-
- expectedType := reflect.TypeOf(expected)
- if fail := ShouldNotBeNil(expectedType); fail != success {
- return shouldCompareWithInterfacePointer
- }
-
- expectedInterface := expectedType.Elem()
-
- if actualType.Implements(expectedInterface) {
- return fmt.Sprintf(shouldNotHaveImplemented, actualType, expectedInterface)
- }
- return success
-}
-
-// ShouldBeError asserts that the first argument implements the error interface.
-// It also compares the first argument against the second argument if provided
-// (which must be an error message string or another error value).
-func ShouldBeError(actual interface{}, expected ...interface{}) string {
- if fail := atMost(1, expected); fail != success {
- return fail
- }
-
- if !isError(actual) {
- return fmt.Sprintf(shouldBeError, reflect.TypeOf(actual))
- }
-
- if len(expected) == 0 {
- return success
- }
-
- if expected := expected[0]; !isString(expected) && !isError(expected) {
- return fmt.Sprintf(shouldBeErrorInvalidComparisonValue, reflect.TypeOf(expected))
- }
- return ShouldEqual(fmt.Sprint(actual), fmt.Sprint(expected[0]))
-}
-
-func isString(value interface{}) bool { _, ok := value.(string); return ok }
-func isError(value interface{}) bool { _, ok := value.(error); return ok }
diff --git a/vendor/github.com/smartystreets/goconvey/CONTRIBUTING.md b/vendor/github.com/smartystreets/goconvey/CONTRIBUTING.md
deleted file mode 100644
index cc0e8e8e..00000000
--- a/vendor/github.com/smartystreets/goconvey/CONTRIBUTING.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Subject: GoConvey maintainers wanted
-
-We'd like to open the project up to additional maintainers who want to move the project forward in a meaningful way.
-
-We've spent significant time at SmartyStreets building GoConvey and it has perfectly met (and exceeded) all of our initial design specifications. We've used it to great effect. Being so well-matched to our development workflows at SmartyStreets, we haven't had a need to hack on it lately. This had been frustrating to many in the community who have ideas for the project and would like to see new features released (and some old bugs fixed). The release of Go 1.5 and the new vendoring experiment has been a source of confusion and hassle for those who have already upgraded and find that GoConvey needs to be brought up to speed.
-
-GoConvey is a popular 2-pronged, open-source github project (1,600+ stargazers, 100+ forks):
-
-- A package you import in your test code that allows you to write BDD-style tests.
-- An executable that runs a local web server which displays auto-updating test results in a web browser.
-
-----
-
-- http://goconvey.co/
-- https://github.com/smartystreets/goconvey
-- https://github.com/smartystreets/goconvey/wiki
-
-_I should mention that the [assertions package](https://github.com/smartystreets/assertions) imported by the convey package is used by other projects at SmartyStreets and so we will be continuing to maintain that project internally._
-
-We hope to hear from you soon. Thanks!
-
----
-
-# Contributing
-
-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.
-
-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:
-
-- _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.
-- _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.
-- _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.
-- _Style:_ Match your approach to **naming** and **formatting** with the surrounding code. Basically, the code you submit shouldn't stand out.
- - "Naming" refers to such constructs as variables, methods, functions, classes, structs, interfaces, packages, modules, directories, files, etc...
- - "Formatting" refers to such constructs as whitespace, horizontal line length, vertical function length, vertical file length, indentation, curly braces, etc...
diff --git a/vendor/github.com/smartystreets/goconvey/LICENSE.md b/vendor/github.com/smartystreets/goconvey/LICENSE.md
deleted file mode 100644
index 3f87a40e..00000000
--- a/vendor/github.com/smartystreets/goconvey/LICENSE.md
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2016 SmartyStreets, LLC
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-NOTE: Various optional and subordinate components carry their own licensing
-requirements and restrictions. Use of those components is subject to the terms
-and conditions outlined the respective license of each component.
diff --git a/vendor/github.com/smartystreets/goconvey/README.md b/vendor/github.com/smartystreets/goconvey/README.md
deleted file mode 100644
index 00df4806..00000000
--- a/vendor/github.com/smartystreets/goconvey/README.md
+++ /dev/null
@@ -1,124 +0,0 @@
-GoConvey is awesome Go testing
-==============================
-
-[![Build Status](https://travis-ci.org/smartystreets/goconvey.png)](https://travis-ci.org/smartystreets/goconvey)
-[![GoDoc](https://godoc.org/github.com/smartystreets/goconvey?status.svg)](http://godoc.org/github.com/smartystreets/goconvey)
-
-
-Welcome to GoConvey, a yummy Go testing tool for gophers. Works with `go test`. Use it in the terminal or browser according to your viewing pleasure. **[View full feature tour.](http://goconvey.co)**
-
-**Features:**
-
-- Directly integrates with `go test`
-- Fully-automatic web UI (works with native Go tests, too)
-- Huge suite of regression tests
-- Shows test coverage (Go 1.2+)
-- Readable, colorized console output (understandable by any manager, IT or not)
-- Test code generator
-- Desktop notifications (optional)
-- Immediately open problem lines in [Sublime Text](http://www.sublimetext.com) ([some assembly required](https://github.com/asuth/subl-handler))
-
-
-You can ask questions about how to use GoConvey on [StackOverflow](http://stackoverflow.com/questions/ask?tags=goconvey,go&title=GoConvey%3A%20). Use the tags `go` and `goconvey`.
-
-**Menu:**
-
-- [Installation](#installation)
-- [Quick start](#quick-start)
-- [Documentation](#documentation)
-- [Screenshots](#screenshots)
-- [Contributors](#contributors)
-
-
-
-
-Installation
-------------
-
- $ go get github.com/smartystreets/goconvey
-
-[Quick start](https://github.com/smartystreets/goconvey/wiki#get-going-in-25-seconds)
------------
-
-Make a test, for example:
-
-```go
-package package_name
-
-import (
- "testing"
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestSpec(t *testing.T) {
-
- // Only pass t into top-level Convey calls
- Convey("Given some integer with a starting value", t, func() {
- x := 1
-
- Convey("When the integer is incremented", func() {
- x++
-
- Convey("The value should be greater by one", func() {
- So(x, ShouldEqual, 2)
- })
- })
- })
-}
-```
-
-
-#### [In the browser](https://github.com/smartystreets/goconvey/wiki/Web-UI)
-
-Start up the GoConvey web server at your project's path:
-
- $ $GOPATH/bin/goconvey
-
-Then watch the test results display in your browser at:
-
- http://localhost:8080
-
-
-If the browser doesn't open automatically, please click [http://localhost:8080](http://localhost:8080) to open manually.
-
-There you have it.
-![](http://d79i1fxsrar4t.cloudfront.net/goconvey.co/gc-1-dark.png)
-As long as GoConvey is running, test results will automatically update in your browser window.
-
-![](http://d79i1fxsrar4t.cloudfront.net/goconvey.co/gc-5-dark.png)
-The design is responsive, so you can squish the browser real tight if you need to put it beside your code.
-
-
-The [web UI](https://github.com/smartystreets/goconvey/wiki/Web-UI) supports traditional Go tests, so use it even if you're not using GoConvey tests.
-
-
-
-#### [In the terminal](https://github.com/smartystreets/goconvey/wiki/Execution)
-
-Just do what you do best:
-
- $ go test
-
-Or if you want the output to include the story:
-
- $ go test -v
-
-
-[Documentation](https://github.com/smartystreets/goconvey/wiki)
------------
-
-Check out the
-
-- [GoConvey wiki](https://github.com/smartystreets/goconvey/wiki),
-- [![GoDoc](https://godoc.org/github.com/smartystreets/goconvey?status.png)](http://godoc.org/github.com/smartystreets/goconvey)
-- and the *_test.go files scattered throughout this project.
-
-[Screenshots](http://goconvey.co)
------------
-
-For web UI and terminal screenshots, check out [the full feature tour](http://goconvey.co).
-
-Contributors
-----------------------
-
-GoConvey is brought to you by [SmartyStreets](https://github.com/smartystreets) and [several contributors](https://github.com/smartystreets/goconvey/graphs/contributors) (Thanks!).
diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions.go b/vendor/github.com/smartystreets/goconvey/convey/assertions.go
deleted file mode 100644
index 97e3bec8..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/assertions.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package convey
-
-import "github.com/smartystreets/assertions"
-
-var (
- ShouldEqual = assertions.ShouldEqual
- ShouldNotEqual = assertions.ShouldNotEqual
- ShouldAlmostEqual = assertions.ShouldAlmostEqual
- ShouldNotAlmostEqual = assertions.ShouldNotAlmostEqual
- ShouldResemble = assertions.ShouldResemble
- ShouldNotResemble = assertions.ShouldNotResemble
- ShouldPointTo = assertions.ShouldPointTo
- ShouldNotPointTo = assertions.ShouldNotPointTo
- ShouldBeNil = assertions.ShouldBeNil
- ShouldNotBeNil = assertions.ShouldNotBeNil
- ShouldBeTrue = assertions.ShouldBeTrue
- ShouldBeFalse = assertions.ShouldBeFalse
- ShouldBeZeroValue = assertions.ShouldBeZeroValue
- ShouldNotBeZeroValue = assertions.ShouldNotBeZeroValue
-
- ShouldBeGreaterThan = assertions.ShouldBeGreaterThan
- ShouldBeGreaterThanOrEqualTo = assertions.ShouldBeGreaterThanOrEqualTo
- ShouldBeLessThan = assertions.ShouldBeLessThan
- ShouldBeLessThanOrEqualTo = assertions.ShouldBeLessThanOrEqualTo
- ShouldBeBetween = assertions.ShouldBeBetween
- ShouldNotBeBetween = assertions.ShouldNotBeBetween
- ShouldBeBetweenOrEqual = assertions.ShouldBeBetweenOrEqual
- ShouldNotBeBetweenOrEqual = assertions.ShouldNotBeBetweenOrEqual
-
- ShouldContain = assertions.ShouldContain
- ShouldNotContain = assertions.ShouldNotContain
- ShouldContainKey = assertions.ShouldContainKey
- ShouldNotContainKey = assertions.ShouldNotContainKey
- ShouldBeIn = assertions.ShouldBeIn
- ShouldNotBeIn = assertions.ShouldNotBeIn
- ShouldBeEmpty = assertions.ShouldBeEmpty
- ShouldNotBeEmpty = assertions.ShouldNotBeEmpty
- ShouldHaveLength = assertions.ShouldHaveLength
-
- ShouldStartWith = assertions.ShouldStartWith
- ShouldNotStartWith = assertions.ShouldNotStartWith
- ShouldEndWith = assertions.ShouldEndWith
- ShouldNotEndWith = assertions.ShouldNotEndWith
- ShouldBeBlank = assertions.ShouldBeBlank
- ShouldNotBeBlank = assertions.ShouldNotBeBlank
- ShouldContainSubstring = assertions.ShouldContainSubstring
- ShouldNotContainSubstring = assertions.ShouldNotContainSubstring
-
- ShouldPanic = assertions.ShouldPanic
- ShouldNotPanic = assertions.ShouldNotPanic
- ShouldPanicWith = assertions.ShouldPanicWith
- ShouldNotPanicWith = assertions.ShouldNotPanicWith
-
- ShouldHaveSameTypeAs = assertions.ShouldHaveSameTypeAs
- ShouldNotHaveSameTypeAs = assertions.ShouldNotHaveSameTypeAs
- ShouldImplement = assertions.ShouldImplement
- ShouldNotImplement = assertions.ShouldNotImplement
-
- ShouldHappenBefore = assertions.ShouldHappenBefore
- ShouldHappenOnOrBefore = assertions.ShouldHappenOnOrBefore
- ShouldHappenAfter = assertions.ShouldHappenAfter
- ShouldHappenOnOrAfter = assertions.ShouldHappenOnOrAfter
- ShouldHappenBetween = assertions.ShouldHappenBetween
- ShouldHappenOnOrBetween = assertions.ShouldHappenOnOrBetween
- ShouldNotHappenOnOrBetween = assertions.ShouldNotHappenOnOrBetween
- ShouldHappenWithin = assertions.ShouldHappenWithin
- ShouldNotHappenWithin = assertions.ShouldNotHappenWithin
- ShouldBeChronological = assertions.ShouldBeChronological
-
- ShouldBeError = assertions.ShouldBeError
-)
diff --git a/vendor/github.com/smartystreets/goconvey/convey/context.go b/vendor/github.com/smartystreets/goconvey/convey/context.go
deleted file mode 100644
index 2c75c2d7..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/context.go
+++ /dev/null
@@ -1,272 +0,0 @@
-package convey
-
-import (
- "fmt"
-
- "github.com/jtolds/gls"
- "github.com/smartystreets/goconvey/convey/reporting"
-)
-
-type conveyErr struct {
- fmt string
- params []interface{}
-}
-
-func (e *conveyErr) Error() string {
- return fmt.Sprintf(e.fmt, e.params...)
-}
-
-func conveyPanic(fmt string, params ...interface{}) {
- panic(&conveyErr{fmt, params})
-}
-
-const (
- missingGoTest = `Top-level calls to Convey(...) need a reference to the *testing.T.
- Hint: Convey("description here", t, func() { /* notice that the second argument was the *testing.T (t)! */ }) `
- extraGoTest = `Only the top-level call to Convey(...) needs a reference to the *testing.T.`
- noStackContext = "Convey operation made without context on goroutine stack.\n" +
- "Hint: Perhaps you meant to use `Convey(..., func(c C){...})` ?"
- differentConveySituations = "Different set of Convey statements on subsequent pass!\nDid not expect %#v."
- multipleIdenticalConvey = "Multiple convey suites with identical names: %#v"
-)
-
-const (
- failureHalt = "___FAILURE_HALT___"
-
- nodeKey = "node"
-)
-
-///////////////////////////////// Stack Context /////////////////////////////////
-
-func getCurrentContext() *context {
- ctx, ok := ctxMgr.GetValue(nodeKey)
- if ok {
- return ctx.(*context)
- }
- return nil
-}
-
-func mustGetCurrentContext() *context {
- ctx := getCurrentContext()
- if ctx == nil {
- conveyPanic(noStackContext)
- }
- return ctx
-}
-
-//////////////////////////////////// Context ////////////////////////////////////
-
-// context magically handles all coordination of Convey's and So assertions.
-//
-// It is tracked on the stack as goroutine-local-storage with the gls package,
-// or explicitly if the user decides to call convey like:
-//
-// Convey(..., func(c C) {
-// c.So(...)
-// })
-//
-// This implements the `C` interface.
-type context struct {
- reporter reporting.Reporter
-
- children map[string]*context
-
- resets []func()
-
- executedOnce bool
- expectChildRun *bool
- complete bool
-
- focus bool
- failureMode FailureMode
-}
-
-// rootConvey is the main entry point to a test suite. This is called when
-// there's no context in the stack already, and items must contain a `t` object,
-// or this panics.
-func rootConvey(items ...interface{}) {
- entry := discover(items)
-
- if entry.Test == nil {
- conveyPanic(missingGoTest)
- }
-
- expectChildRun := true
- ctx := &context{
- reporter: buildReporter(),
-
- children: make(map[string]*context),
-
- expectChildRun: &expectChildRun,
-
- focus: entry.Focus,
- failureMode: defaultFailureMode.combine(entry.FailMode),
- }
- ctxMgr.SetValues(gls.Values{nodeKey: ctx}, func() {
- ctx.reporter.BeginStory(reporting.NewStoryReport(entry.Test))
- defer ctx.reporter.EndStory()
-
- for ctx.shouldVisit() {
- ctx.conveyInner(entry.Situation, entry.Func)
- expectChildRun = true
- }
- })
-}
-
-//////////////////////////////////// Methods ////////////////////////////////////
-
-func (ctx *context) SkipConvey(items ...interface{}) {
- ctx.Convey(items, skipConvey)
-}
-
-func (ctx *context) FocusConvey(items ...interface{}) {
- ctx.Convey(items, focusConvey)
-}
-
-func (ctx *context) Convey(items ...interface{}) {
- entry := discover(items)
-
- // we're a branch, or leaf (on the wind)
- if entry.Test != nil {
- conveyPanic(extraGoTest)
- }
- if ctx.focus && !entry.Focus {
- return
- }
-
- var inner_ctx *context
- if ctx.executedOnce {
- var ok bool
- inner_ctx, ok = ctx.children[entry.Situation]
- if !ok {
- conveyPanic(differentConveySituations, entry.Situation)
- }
- } else {
- if _, ok := ctx.children[entry.Situation]; ok {
- conveyPanic(multipleIdenticalConvey, entry.Situation)
- }
- inner_ctx = &context{
- reporter: ctx.reporter,
-
- children: make(map[string]*context),
-
- expectChildRun: ctx.expectChildRun,
-
- focus: entry.Focus,
- failureMode: ctx.failureMode.combine(entry.FailMode),
- }
- ctx.children[entry.Situation] = inner_ctx
- }
-
- if inner_ctx.shouldVisit() {
- ctxMgr.SetValues(gls.Values{nodeKey: inner_ctx}, func() {
- inner_ctx.conveyInner(entry.Situation, entry.Func)
- })
- }
-}
-
-func (ctx *context) SkipSo(stuff ...interface{}) {
- ctx.assertionReport(reporting.NewSkipReport())
-}
-
-func (ctx *context) So(actual interface{}, assert assertion, expected ...interface{}) {
- if result := assert(actual, expected...); result == assertionSuccess {
- ctx.assertionReport(reporting.NewSuccessReport())
- } else {
- ctx.assertionReport(reporting.NewFailureReport(result))
- }
-}
-
-func (ctx *context) Reset(action func()) {
- /* TODO: Failure mode configuration */
- ctx.resets = append(ctx.resets, action)
-}
-
-func (ctx *context) Print(items ...interface{}) (int, error) {
- fmt.Fprint(ctx.reporter, items...)
- return fmt.Print(items...)
-}
-
-func (ctx *context) Println(items ...interface{}) (int, error) {
- fmt.Fprintln(ctx.reporter, items...)
- return fmt.Println(items...)
-}
-
-func (ctx *context) Printf(format string, items ...interface{}) (int, error) {
- fmt.Fprintf(ctx.reporter, format, items...)
- return fmt.Printf(format, items...)
-}
-
-//////////////////////////////////// Private ////////////////////////////////////
-
-// shouldVisit returns true iff we should traverse down into a Convey. Note
-// that just because we don't traverse a Convey this time, doesn't mean that
-// we may not traverse it on a subsequent pass.
-func (c *context) shouldVisit() bool {
- return !c.complete && *c.expectChildRun
-}
-
-// conveyInner is the function which actually executes the user's anonymous test
-// function body. At this point, Convey or RootConvey has decided that this
-// function should actually run.
-func (ctx *context) conveyInner(situation string, f func(C)) {
- // Record/Reset state for next time.
- defer func() {
- ctx.executedOnce = true
-
- // This is only needed at the leaves, but there's no harm in also setting it
- // when returning from branch Convey's
- *ctx.expectChildRun = false
- }()
-
- // Set up+tear down our scope for the reporter
- ctx.reporter.Enter(reporting.NewScopeReport(situation))
- defer ctx.reporter.Exit()
-
- // Recover from any panics in f, and assign the `complete` status for this
- // node of the tree.
- defer func() {
- ctx.complete = true
- if problem := recover(); problem != nil {
- if problem, ok := problem.(*conveyErr); ok {
- panic(problem)
- }
- if problem != failureHalt {
- ctx.reporter.Report(reporting.NewErrorReport(problem))
- }
- } else {
- for _, child := range ctx.children {
- if !child.complete {
- ctx.complete = false
- return
- }
- }
- }
- }()
-
- // Resets are registered as the `f` function executes, so nil them here.
- // All resets are run in registration order (FIFO).
- ctx.resets = []func(){}
- defer func() {
- for _, r := range ctx.resets {
- // panics handled by the previous defer
- r()
- }
- }()
-
- if f == nil {
- // if f is nil, this was either a Convey(..., nil), or a SkipConvey
- ctx.reporter.Report(reporting.NewSkipReport())
- } else {
- f(ctx)
- }
-}
-
-// assertionReport is a helper for So and SkipSo which makes the report and
-// then possibly panics, depending on the current context's failureMode.
-func (ctx *context) assertionReport(r *reporting.AssertionResult) {
- ctx.reporter.Report(r)
- if r.Failure != "" && ctx.failureMode == FailureHalts {
- panic(failureHalt)
- }
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey b/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey
deleted file mode 100644
index a2d9327d..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey
+++ /dev/null
@@ -1,4 +0,0 @@
-#ignore
--timeout=1s
-#-covermode=count
-#-coverpkg=github.com/smartystreets/goconvey/convey,github.com/smartystreets/goconvey/convey/gotest,github.com/smartystreets/goconvey/convey/reporting \ No newline at end of file
diff --git a/vendor/github.com/smartystreets/goconvey/convey/discovery.go b/vendor/github.com/smartystreets/goconvey/convey/discovery.go
deleted file mode 100644
index eb8d4cb2..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/discovery.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package convey
-
-type actionSpecifier uint8
-
-const (
- noSpecifier actionSpecifier = iota
- skipConvey
- focusConvey
-)
-
-type suite struct {
- Situation string
- Test t
- Focus bool
- Func func(C) // nil means skipped
- FailMode FailureMode
-}
-
-func newSuite(situation string, failureMode FailureMode, f func(C), test t, specifier actionSpecifier) *suite {
- ret := &suite{
- Situation: situation,
- Test: test,
- Func: f,
- FailMode: failureMode,
- }
- switch specifier {
- case skipConvey:
- ret.Func = nil
- case focusConvey:
- ret.Focus = true
- }
- return ret
-}
-
-func discover(items []interface{}) *suite {
- name, items := parseName(items)
- test, items := parseGoTest(items)
- failure, items := parseFailureMode(items)
- action, items := parseAction(items)
- specifier, items := parseSpecifier(items)
-
- if len(items) != 0 {
- conveyPanic(parseError)
- }
-
- return newSuite(name, failure, action, test, specifier)
-}
-func item(items []interface{}) interface{} {
- if len(items) == 0 {
- conveyPanic(parseError)
- }
- return items[0]
-}
-func parseName(items []interface{}) (string, []interface{}) {
- if name, parsed := item(items).(string); parsed {
- return name, items[1:]
- }
- conveyPanic(parseError)
- panic("never get here")
-}
-func parseGoTest(items []interface{}) (t, []interface{}) {
- if test, parsed := item(items).(t); parsed {
- return test, items[1:]
- }
- return nil, items
-}
-func parseFailureMode(items []interface{}) (FailureMode, []interface{}) {
- if mode, parsed := item(items).(FailureMode); parsed {
- return mode, items[1:]
- }
- return FailureInherits, items
-}
-func parseAction(items []interface{}) (func(C), []interface{}) {
- switch x := item(items).(type) {
- case nil:
- return nil, items[1:]
- case func(C):
- return x, items[1:]
- case func():
- return func(C) { x() }, items[1:]
- }
- conveyPanic(parseError)
- panic("never get here")
-}
-func parseSpecifier(items []interface{}) (actionSpecifier, []interface{}) {
- if len(items) == 0 {
- return noSpecifier, items
- }
- if spec, ok := items[0].(actionSpecifier); ok {
- return spec, items[1:]
- }
- conveyPanic(parseError)
- panic("never get here")
-}
-
-// This interface allows us to pass the *testing.T struct
-// throughout the internals of this package without ever
-// having to import the "testing" package.
-type t interface {
- Fail()
-}
-
-const parseError = "You must provide a name (string), then a *testing.T (if in outermost scope), an optional FailureMode, and then an action (func())."
diff --git a/vendor/github.com/smartystreets/goconvey/convey/doc.go b/vendor/github.com/smartystreets/goconvey/convey/doc.go
deleted file mode 100644
index a60e32ae..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/doc.go
+++ /dev/null
@@ -1,218 +0,0 @@
-// Package convey contains all of the public-facing entry points to this project.
-// This means that it should never be required of the user to import any other
-// packages from this project as they serve internal purposes.
-package convey
-
-import "github.com/smartystreets/goconvey/convey/reporting"
-
-////////////////////////////////// suite //////////////////////////////////
-
-// C is the Convey context which you can optionally obtain in your action
-// by calling Convey like:
-//
-// Convey(..., func(c C) {
-// ...
-// })
-//
-// See the documentation on Convey for more details.
-//
-// All methods in this context behave identically to the global functions of the
-// same name in this package.
-type C interface {
- Convey(items ...interface{})
- SkipConvey(items ...interface{})
- FocusConvey(items ...interface{})
-
- So(actual interface{}, assert assertion, expected ...interface{})
- SkipSo(stuff ...interface{})
-
- Reset(action func())
-
- Println(items ...interface{}) (int, error)
- Print(items ...interface{}) (int, error)
- Printf(format string, items ...interface{}) (int, error)
-}
-
-// Convey is the method intended for use when declaring the scopes of
-// a specification. Each scope has a description and a func() which may contain
-// other calls to Convey(), Reset() or Should-style assertions. Convey calls can
-// be nested as far as you see fit.
-//
-// IMPORTANT NOTE: The top-level Convey() within a Test method
-// must conform to the following signature:
-//
-// Convey(description string, t *testing.T, action func())
-//
-// All other calls should look like this (no need to pass in *testing.T):
-//
-// Convey(description string, action func())
-//
-// Don't worry, goconvey will panic if you get it wrong so you can fix it.
-//
-// Additionally, you may explicitly obtain access to the Convey context by doing:
-//
-// Convey(description string, action func(c C))
-//
-// You may need to do this if you want to pass the context through to a
-// goroutine, or to close over the context in a handler to a library which
-// calls your handler in a goroutine (httptest comes to mind).
-//
-// All Convey()-blocks also accept an optional parameter of FailureMode which sets
-// how goconvey should treat failures for So()-assertions in the block and
-// nested blocks. See the constants in this file for the available options.
-//
-// By default it will inherit from its parent block and the top-level blocks
-// default to the FailureHalts setting.
-//
-// This parameter is inserted before the block itself:
-//
-// Convey(description string, t *testing.T, mode FailureMode, action func())
-// Convey(description string, mode FailureMode, action func())
-//
-// See the examples package for, well, examples.
-func Convey(items ...interface{}) {
- if ctx := getCurrentContext(); ctx == nil {
- rootConvey(items...)
- } else {
- ctx.Convey(items...)
- }
-}
-
-// SkipConvey is analagous to Convey except that the scope is not executed
-// (which means that child scopes defined within this scope are not run either).
-// The reporter will be notified that this step was skipped.
-func SkipConvey(items ...interface{}) {
- Convey(append(items, skipConvey)...)
-}
-
-// FocusConvey is has the inverse effect of SkipConvey. If the top-level
-// Convey is changed to `FocusConvey`, only nested scopes that are defined
-// with FocusConvey will be run. The rest will be ignored completely. This
-// is handy when debugging a large suite that runs a misbehaving function
-// repeatedly as you can disable all but one of that function
-// without swaths of `SkipConvey` calls, just a targeted chain of calls
-// to FocusConvey.
-func FocusConvey(items ...interface{}) {
- Convey(append(items, focusConvey)...)
-}
-
-// Reset registers a cleanup function to be run after each Convey()
-// in the same scope. See the examples package for a simple use case.
-func Reset(action func()) {
- mustGetCurrentContext().Reset(action)
-}
-
-/////////////////////////////////// Assertions ///////////////////////////////////
-
-// assertion is an alias for a function with a signature that the convey.So()
-// method can handle. Any future or custom assertions should conform to this
-// method signature. The return value should be an empty string if the assertion
-// passes and a well-formed failure message if not.
-type assertion func(actual interface{}, expected ...interface{}) string
-
-const assertionSuccess = ""
-
-// So is the means by which assertions are made against the system under test.
-// The majority of exported names in the assertions package begin with the word
-// 'Should' and describe how the first argument (actual) should compare with any
-// of the final (expected) arguments. How many final arguments are accepted
-// depends on the particular assertion that is passed in as the assert argument.
-// See the examples package for use cases and the assertions package for
-// documentation on specific assertion methods. A failing assertion will
-// cause t.Fail() to be invoked--you should never call this method (or other
-// failure-inducing methods) in your test code. Leave that to GoConvey.
-func So(actual interface{}, assert assertion, expected ...interface{}) {
- mustGetCurrentContext().So(actual, assert, expected...)
-}
-
-// SkipSo is analagous to So except that the assertion that would have been passed
-// to So is not executed and the reporter is notified that the assertion was skipped.
-func SkipSo(stuff ...interface{}) {
- mustGetCurrentContext().SkipSo()
-}
-
-// FailureMode is a type which determines how the So() blocks should fail
-// if their assertion fails. See constants further down for acceptable values
-type FailureMode string
-
-const (
-
- // FailureContinues is a failure mode which prevents failing
- // So()-assertions from halting Convey-block execution, instead
- // allowing the test to continue past failing So()-assertions.
- FailureContinues FailureMode = "continue"
-
- // FailureHalts is the default setting for a top-level Convey()-block
- // and will cause all failing So()-assertions to halt further execution
- // in that test-arm and continue on to the next arm.
- FailureHalts FailureMode = "halt"
-
- // FailureInherits is the default setting for failure-mode, it will
- // default to the failure-mode of the parent block. You should never
- // need to specify this mode in your tests..
- FailureInherits FailureMode = "inherits"
-)
-
-func (f FailureMode) combine(other FailureMode) FailureMode {
- if other == FailureInherits {
- return f
- }
- return other
-}
-
-var defaultFailureMode FailureMode = FailureHalts
-
-// SetDefaultFailureMode allows you to specify the default failure mode
-// for all Convey blocks. It is meant to be used in an init function to
-// allow the default mode to be changdd across all tests for an entire packgae
-// but it can be used anywhere.
-func SetDefaultFailureMode(mode FailureMode) {
- if mode == FailureContinues || mode == FailureHalts {
- defaultFailureMode = mode
- } else {
- panic("You may only use the constants named 'FailureContinues' and 'FailureHalts' as default failure modes.")
- }
-}
-
-//////////////////////////////////// Print functions ////////////////////////////////////
-
-// Print is analogous to fmt.Print (and it even calls fmt.Print). It ensures that
-// output is aligned with the corresponding scopes in the web UI.
-func Print(items ...interface{}) (written int, err error) {
- return mustGetCurrentContext().Print(items...)
-}
-
-// Print is analogous to fmt.Println (and it even calls fmt.Println). It ensures that
-// output is aligned with the corresponding scopes in the web UI.
-func Println(items ...interface{}) (written int, err error) {
- return mustGetCurrentContext().Println(items...)
-}
-
-// Print is analogous to fmt.Printf (and it even calls fmt.Printf). It ensures that
-// output is aligned with the corresponding scopes in the web UI.
-func Printf(format string, items ...interface{}) (written int, err error) {
- return mustGetCurrentContext().Printf(format, items...)
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-// SuppressConsoleStatistics prevents automatic printing of console statistics.
-// Calling PrintConsoleStatistics explicitly will force printing of statistics.
-func SuppressConsoleStatistics() {
- reporting.SuppressConsoleStatistics()
-}
-
-// PrintConsoleStatistics may be called at any time to print assertion statistics.
-// Generally, the best place to do this would be in a TestMain function,
-// after all tests have been run. Something like this:
-//
-// func TestMain(m *testing.M) {
-// convey.SuppressConsoleStatistics()
-// result := m.Run()
-// convey.PrintConsoleStatistics()
-// os.Exit(result)
-// }
-//
-func PrintConsoleStatistics() {
- reporting.PrintConsoleStatistics()
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go b/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go
deleted file mode 100644
index 167c8fb7..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Package gotest contains internal functionality. Although this package
-// contains one or more exported names it is not intended for public
-// consumption. See the examples package for how to use this project.
-package gotest
-
-import (
- "runtime"
- "strings"
-)
-
-func ResolveExternalCaller() (file string, line int, name string) {
- var caller_id uintptr
- callers := runtime.Callers(0, callStack)
-
- for x := 0; x < callers; x++ {
- caller_id, file, line, _ = runtime.Caller(x)
- if strings.HasSuffix(file, "_test.go") || strings.HasSuffix(file, "_tests.go") {
- name = runtime.FuncForPC(caller_id).Name()
- return
- }
- }
- file, line, name = "<unknown file>", -1, "<unknown name>"
- return // panic?
-}
-
-const maxStackDepth = 100 // This had better be enough...
-
-var callStack []uintptr = make([]uintptr, maxStackDepth, maxStackDepth)
diff --git a/vendor/github.com/smartystreets/goconvey/convey/init.go b/vendor/github.com/smartystreets/goconvey/convey/init.go
deleted file mode 100644
index cb930a0d..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/init.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package convey
-
-import (
- "flag"
- "os"
-
- "github.com/jtolds/gls"
- "github.com/smartystreets/assertions"
- "github.com/smartystreets/goconvey/convey/reporting"
-)
-
-func init() {
- assertions.GoConveyMode(true)
-
- declareFlags()
-
- ctxMgr = gls.NewContextManager()
-}
-
-func declareFlags() {
- flag.BoolVar(&json, "convey-json", false, "When true, emits results in JSON blocks. Default: 'false'")
- flag.BoolVar(&silent, "convey-silent", false, "When true, all output from GoConvey is suppressed.")
- flag.BoolVar(&story, "convey-story", false, "When true, emits story output, otherwise emits dot output. When not provided, this flag mirrors the value of the '-test.v' flag")
-
- if noStoryFlagProvided() {
- story = verboseEnabled
- }
-
- // FYI: flag.Parse() is called from the testing package.
-}
-
-func noStoryFlagProvided() bool {
- return !story && !storyDisabled
-}
-
-func buildReporter() reporting.Reporter {
- selectReporter := os.Getenv("GOCONVEY_REPORTER")
-
- switch {
- case testReporter != nil:
- return testReporter
- case json || selectReporter == "json":
- return reporting.BuildJsonReporter()
- case silent || selectReporter == "silent":
- return reporting.BuildSilentReporter()
- case selectReporter == "dot":
- // Story is turned on when verbose is set, so we need to check for dot reporter first.
- return reporting.BuildDotReporter()
- case story || selectReporter == "story":
- return reporting.BuildStoryReporter()
- default:
- return reporting.BuildDotReporter()
- }
-}
-
-var (
- ctxMgr *gls.ContextManager
-
- // only set by internal tests
- testReporter reporting.Reporter
-)
-
-var (
- json bool
- silent bool
- story bool
-
- verboseEnabled = flagFound("-test.v=true")
- storyDisabled = flagFound("-story=false")
-)
-
-// flagFound parses the command line args manually for flags defined in other
-// packages. Like the '-v' flag from the "testing" package, for instance.
-func flagFound(flagValue string) bool {
- for _, arg := range os.Args {
- if arg == flagValue {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go b/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go
deleted file mode 100644
index 777b2a51..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package convey
-
-import (
- "github.com/smartystreets/goconvey/convey/reporting"
-)
-
-type nilReporter struct{}
-
-func (self *nilReporter) BeginStory(story *reporting.StoryReport) {}
-func (self *nilReporter) Enter(scope *reporting.ScopeReport) {}
-func (self *nilReporter) Report(report *reporting.AssertionResult) {}
-func (self *nilReporter) Exit() {}
-func (self *nilReporter) EndStory() {}
-func (self *nilReporter) Write(p []byte) (int, error) { return len(p), nil }
-func newNilReporter() *nilReporter { return &nilReporter{} }
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go
deleted file mode 100644
index 7bf67dbb..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package reporting
-
-import (
- "fmt"
- "io"
-)
-
-type console struct{}
-
-func (self *console) Write(p []byte) (n int, err error) {
- return fmt.Print(string(p))
-}
-
-func NewConsole() io.Writer {
- return new(console)
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go
deleted file mode 100644
index a37d0019..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Package reporting contains internal functionality related
-// to console reporting and output. Although this package has
-// exported names is not intended for public consumption. See the
-// examples package for how to use this project.
-package reporting
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go
deleted file mode 100644
index 47d57c6b..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package reporting
-
-import "fmt"
-
-type dot struct{ out *Printer }
-
-func (self *dot) BeginStory(story *StoryReport) {}
-
-func (self *dot) Enter(scope *ScopeReport) {}
-
-func (self *dot) Report(report *AssertionResult) {
- if report.Error != nil {
- fmt.Print(redColor)
- self.out.Insert(dotError)
- } else if report.Failure != "" {
- fmt.Print(yellowColor)
- self.out.Insert(dotFailure)
- } else if report.Skipped {
- fmt.Print(yellowColor)
- self.out.Insert(dotSkip)
- } else {
- fmt.Print(greenColor)
- self.out.Insert(dotSuccess)
- }
- fmt.Print(resetColor)
-}
-
-func (self *dot) Exit() {}
-
-func (self *dot) EndStory() {}
-
-func (self *dot) Write(content []byte) (written int, err error) {
- return len(content), nil // no-op
-}
-
-func NewDotReporter(out *Printer) *dot {
- self := new(dot)
- self.out = out
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go
deleted file mode 100644
index c396e16b..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package reporting
-
-type gotestReporter struct{ test T }
-
-func (self *gotestReporter) BeginStory(story *StoryReport) {
- self.test = story.Test
-}
-
-func (self *gotestReporter) Enter(scope *ScopeReport) {}
-
-func (self *gotestReporter) Report(r *AssertionResult) {
- if !passed(r) {
- self.test.Fail()
- }
-}
-
-func (self *gotestReporter) Exit() {}
-
-func (self *gotestReporter) EndStory() {
- self.test = nil
-}
-
-func (self *gotestReporter) Write(content []byte) (written int, err error) {
- return len(content), nil // no-op
-}
-
-func NewGoTestReporter() *gotestReporter {
- return new(gotestReporter)
-}
-
-func passed(r *AssertionResult) bool {
- return r.Error == nil && r.Failure == ""
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go
deleted file mode 100644
index 99c3bd6d..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/init.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package reporting
-
-import (
- "os"
- "runtime"
- "strings"
-)
-
-func init() {
- if !isColorableTerminal() {
- monochrome()
- }
-
- if runtime.GOOS == "windows" {
- success, failure, error_ = dotSuccess, dotFailure, dotError
- }
-}
-
-func BuildJsonReporter() Reporter {
- out := NewPrinter(NewConsole())
- return NewReporters(
- NewGoTestReporter(),
- NewJsonReporter(out))
-}
-func BuildDotReporter() Reporter {
- out := NewPrinter(NewConsole())
- return NewReporters(
- NewGoTestReporter(),
- NewDotReporter(out),
- NewProblemReporter(out),
- consoleStatistics)
-}
-func BuildStoryReporter() Reporter {
- out := NewPrinter(NewConsole())
- return NewReporters(
- NewGoTestReporter(),
- NewStoryReporter(out),
- NewProblemReporter(out),
- consoleStatistics)
-}
-func BuildSilentReporter() Reporter {
- out := NewPrinter(NewConsole())
- return NewReporters(
- NewGoTestReporter(),
- NewSilentProblemReporter(out))
-}
-
-var (
- newline = "\n"
- success = "✔"
- failure = "✘"
- error_ = "🔥"
- skip = "⚠"
- dotSuccess = "."
- dotFailure = "x"
- dotError = "E"
- dotSkip = "S"
- errorTemplate = "* %s \nLine %d: - %v \n%s\n"
- failureTemplate = "* %s \nLine %d:\n%s\n%s\n"
-)
-
-var (
- greenColor = "\033[32m"
- yellowColor = "\033[33m"
- redColor = "\033[31m"
- resetColor = "\033[0m"
-)
-
-var consoleStatistics = NewStatisticsReporter(NewPrinter(NewConsole()))
-
-func SuppressConsoleStatistics() { consoleStatistics.Suppress() }
-func PrintConsoleStatistics() { consoleStatistics.PrintSummary() }
-
-// QuietMode disables all console output symbols. This is only meant to be used
-// for tests that are internal to goconvey where the output is distracting or
-// otherwise not needed in the test output.
-func QuietMode() {
- success, failure, error_, skip, dotSuccess, dotFailure, dotError, dotSkip = "", "", "", "", "", "", "", ""
-}
-
-func monochrome() {
- greenColor, yellowColor, redColor, resetColor = "", "", "", ""
-}
-
-func isColorableTerminal() bool {
- return strings.Contains(os.Getenv("TERM"), "color")
-}
-
-// This interface allows us to pass the *testing.T struct
-// throughout the internals of this tool without ever
-// having to import the "testing" package.
-type T interface {
- Fail()
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/json.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/json.go
deleted file mode 100644
index f8526979..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/json.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// TODO: under unit test
-
-package reporting
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "strings"
-)
-
-type JsonReporter struct {
- out *Printer
- currentKey []string
- current *ScopeResult
- index map[string]*ScopeResult
- scopes []*ScopeResult
-}
-
-func (self *JsonReporter) depth() int { return len(self.currentKey) }
-
-func (self *JsonReporter) BeginStory(story *StoryReport) {}
-
-func (self *JsonReporter) Enter(scope *ScopeReport) {
- self.currentKey = append(self.currentKey, scope.Title)
- ID := strings.Join(self.currentKey, "|")
- if _, found := self.index[ID]; !found {
- next := newScopeResult(scope.Title, self.depth(), scope.File, scope.Line)
- self.scopes = append(self.scopes, next)
- self.index[ID] = next
- }
- self.current = self.index[ID]
-}
-
-func (self *JsonReporter) Report(report *AssertionResult) {
- self.current.Assertions = append(self.current.Assertions, report)
-}
-
-func (self *JsonReporter) Exit() {
- self.currentKey = self.currentKey[:len(self.currentKey)-1]
-}
-
-func (self *JsonReporter) EndStory() {
- self.report()
- self.reset()
-}
-func (self *JsonReporter) report() {
- scopes := []string{}
- for _, scope := range self.scopes {
- serialized, err := json.Marshal(scope)
- if err != nil {
- self.out.Println(jsonMarshalFailure)
- panic(err)
- }
- var buffer bytes.Buffer
- json.Indent(&buffer, serialized, "", " ")
- scopes = append(scopes, buffer.String())
- }
- self.out.Print(fmt.Sprintf("%s\n%s,\n%s\n", OpenJson, strings.Join(scopes, ","), CloseJson))
-}
-func (self *JsonReporter) reset() {
- self.scopes = []*ScopeResult{}
- self.index = map[string]*ScopeResult{}
- self.currentKey = nil
-}
-
-func (self *JsonReporter) Write(content []byte) (written int, err error) {
- self.current.Output += string(content)
- return len(content), nil
-}
-
-func NewJsonReporter(out *Printer) *JsonReporter {
- self := new(JsonReporter)
- self.out = out
- self.reset()
- return self
-}
-
-const OpenJson = ">->->OPEN-JSON->->->" // "⌦"
-const CloseJson = "<-<-<-CLOSE-JSON<-<-<" // "⌫"
-const jsonMarshalFailure = `
-
-GOCONVEY_JSON_MARSHALL_FAILURE: There was an error when attempting to convert test results to JSON.
-Please file a bug report and reference the code that caused this failure if possible.
-
-Here's the panic:
-
-`
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go
deleted file mode 100644
index 3dac0d4d..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package reporting
-
-import (
- "fmt"
- "io"
- "strings"
-)
-
-type Printer struct {
- out io.Writer
- prefix string
-}
-
-func (self *Printer) Println(message string, values ...interface{}) {
- formatted := self.format(message, values...) + newline
- self.out.Write([]byte(formatted))
-}
-
-func (self *Printer) Print(message string, values ...interface{}) {
- formatted := self.format(message, values...)
- self.out.Write([]byte(formatted))
-}
-
-func (self *Printer) Insert(text string) {
- self.out.Write([]byte(text))
-}
-
-func (self *Printer) format(message string, values ...interface{}) string {
- var formatted string
- if len(values) == 0 {
- formatted = self.prefix + message
- } else {
- formatted = self.prefix + fmt_Sprintf(message, values...)
- }
- indented := strings.Replace(formatted, newline, newline+self.prefix, -1)
- return strings.TrimRight(indented, space)
-}
-
-// Extracting fmt.Sprintf to a separate variable circumvents go vet, which, as of go 1.10 is run with go test.
-var fmt_Sprintf = fmt.Sprintf
-
-func (self *Printer) Indent() {
- self.prefix += pad
-}
-
-func (self *Printer) Dedent() {
- if len(self.prefix) >= padLength {
- self.prefix = self.prefix[:len(self.prefix)-padLength]
- }
-}
-
-func NewPrinter(out io.Writer) *Printer {
- self := new(Printer)
- self.out = out
- return self
-}
-
-const space = " "
-const pad = space + space
-const padLength = len(pad)
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go
deleted file mode 100644
index 33d5e147..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/problems.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package reporting
-
-import "fmt"
-
-type problem struct {
- silent bool
- out *Printer
- errors []*AssertionResult
- failures []*AssertionResult
-}
-
-func (self *problem) BeginStory(story *StoryReport) {}
-
-func (self *problem) Enter(scope *ScopeReport) {}
-
-func (self *problem) Report(report *AssertionResult) {
- if report.Error != nil {
- self.errors = append(self.errors, report)
- } else if report.Failure != "" {
- self.failures = append(self.failures, report)
- }
-}
-
-func (self *problem) Exit() {}
-
-func (self *problem) EndStory() {
- self.show(self.showErrors, redColor)
- self.show(self.showFailures, yellowColor)
- self.prepareForNextStory()
-}
-func (self *problem) show(display func(), color string) {
- if !self.silent {
- fmt.Print(color)
- }
- display()
- if !self.silent {
- fmt.Print(resetColor)
- }
- self.out.Dedent()
-}
-func (self *problem) showErrors() {
- for i, e := range self.errors {
- if i == 0 {
- self.out.Println("\nErrors:\n")
- self.out.Indent()
- }
- self.out.Println(errorTemplate, e.File, e.Line, e.Error, e.StackTrace)
- }
-}
-func (self *problem) showFailures() {
- for i, f := range self.failures {
- if i == 0 {
- self.out.Println("\nFailures:\n")
- self.out.Indent()
- }
- self.out.Println(failureTemplate, f.File, f.Line, f.Failure, f.StackTrace)
- }
-}
-
-func (self *problem) Write(content []byte) (written int, err error) {
- return len(content), nil // no-op
-}
-
-func NewProblemReporter(out *Printer) *problem {
- self := new(problem)
- self.out = out
- self.prepareForNextStory()
- return self
-}
-
-func NewSilentProblemReporter(out *Printer) *problem {
- self := NewProblemReporter(out)
- self.silent = true
- return self
-}
-
-func (self *problem) prepareForNextStory() {
- self.errors = []*AssertionResult{}
- self.failures = []*AssertionResult{}
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go
deleted file mode 100644
index cce6c5e4..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package reporting
-
-import "io"
-
-type Reporter interface {
- BeginStory(story *StoryReport)
- Enter(scope *ScopeReport)
- Report(r *AssertionResult)
- Exit()
- EndStory()
- io.Writer
-}
-
-type reporters struct{ collection []Reporter }
-
-func (self *reporters) BeginStory(s *StoryReport) { self.foreach(func(r Reporter) { r.BeginStory(s) }) }
-func (self *reporters) Enter(s *ScopeReport) { self.foreach(func(r Reporter) { r.Enter(s) }) }
-func (self *reporters) Report(a *AssertionResult) { self.foreach(func(r Reporter) { r.Report(a) }) }
-func (self *reporters) Exit() { self.foreach(func(r Reporter) { r.Exit() }) }
-func (self *reporters) EndStory() { self.foreach(func(r Reporter) { r.EndStory() }) }
-
-func (self *reporters) Write(contents []byte) (written int, err error) {
- self.foreach(func(r Reporter) {
- written, err = r.Write(contents)
- })
- return written, err
-}
-
-func (self *reporters) foreach(action func(Reporter)) {
- for _, r := range self.collection {
- action(r)
- }
-}
-
-func NewReporters(collection ...Reporter) *reporters {
- self := new(reporters)
- self.collection = collection
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey b/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go
deleted file mode 100644
index 712e6ade..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go
+++ /dev/null
@@ -1,179 +0,0 @@
-package reporting
-
-import (
- "encoding/json"
- "fmt"
- "runtime"
- "strings"
-
- "github.com/smartystreets/goconvey/convey/gotest"
-)
-
-////////////////// ScopeReport ////////////////////
-
-type ScopeReport struct {
- Title string
- File string
- Line int
-}
-
-func NewScopeReport(title string) *ScopeReport {
- file, line, _ := gotest.ResolveExternalCaller()
- self := new(ScopeReport)
- self.Title = title
- self.File = file
- self.Line = line
- return self
-}
-
-////////////////// ScopeResult ////////////////////
-
-type ScopeResult struct {
- Title string
- File string
- Line int
- Depth int
- Assertions []*AssertionResult
- Output string
-}
-
-func newScopeResult(title string, depth int, file string, line int) *ScopeResult {
- self := new(ScopeResult)
- self.Title = title
- self.Depth = depth
- self.File = file
- self.Line = line
- self.Assertions = []*AssertionResult{}
- return self
-}
-
-/////////////////// StoryReport /////////////////////
-
-type StoryReport struct {
- Test T
- Name string
- File string
- Line int
-}
-
-func NewStoryReport(test T) *StoryReport {
- file, line, name := gotest.ResolveExternalCaller()
- name = removePackagePath(name)
- self := new(StoryReport)
- self.Test = test
- self.Name = name
- self.File = file
- self.Line = line
- return self
-}
-
-// name comes in looking like "github.com/smartystreets/goconvey/examples.TestName".
-// We only want the stuff after the last '.', which is the name of the test function.
-func removePackagePath(name string) string {
- parts := strings.Split(name, ".")
- return parts[len(parts)-1]
-}
-
-/////////////////// FailureView ////////////////////////
-
-// This struct is also declared in github.com/smartystreets/assertions.
-// The json struct tags should be equal in both declarations.
-type FailureView struct {
- Message string `json:"Message"`
- Expected string `json:"Expected"`
- Actual string `json:"Actual"`
-}
-
-////////////////////AssertionResult //////////////////////
-
-type AssertionResult struct {
- File string
- Line int
- Expected string
- Actual string
- Failure string
- Error interface{}
- StackTrace string
- Skipped bool
-}
-
-func NewFailureReport(failure string) *AssertionResult {
- report := new(AssertionResult)
- report.File, report.Line = caller()
- report.StackTrace = stackTrace()
- parseFailure(failure, report)
- return report
-}
-func parseFailure(failure string, report *AssertionResult) {
- view := new(FailureView)
- err := json.Unmarshal([]byte(failure), view)
- if err == nil {
- report.Failure = view.Message
- report.Expected = view.Expected
- report.Actual = view.Actual
- } else {
- report.Failure = failure
- }
-}
-func NewErrorReport(err interface{}) *AssertionResult {
- report := new(AssertionResult)
- report.File, report.Line = caller()
- report.StackTrace = fullStackTrace()
- report.Error = fmt.Sprintf("%v", err)
- return report
-}
-func NewSuccessReport() *AssertionResult {
- return new(AssertionResult)
-}
-func NewSkipReport() *AssertionResult {
- report := new(AssertionResult)
- report.File, report.Line = caller()
- report.StackTrace = fullStackTrace()
- report.Skipped = true
- return report
-}
-
-func caller() (file string, line int) {
- file, line, _ = gotest.ResolveExternalCaller()
- return
-}
-
-func stackTrace() string {
- buffer := make([]byte, 1024*64)
- n := runtime.Stack(buffer, false)
- return removeInternalEntries(string(buffer[:n]))
-}
-func fullStackTrace() string {
- buffer := make([]byte, 1024*64)
- n := runtime.Stack(buffer, true)
- return removeInternalEntries(string(buffer[:n]))
-}
-func removeInternalEntries(stack string) string {
- lines := strings.Split(stack, newline)
- filtered := []string{}
- for _, line := range lines {
- if !isExternal(line) {
- filtered = append(filtered, line)
- }
- }
- return strings.Join(filtered, newline)
-}
-func isExternal(line string) bool {
- for _, p := range internalPackages {
- if strings.Contains(line, p) {
- return true
- }
- }
- return false
-}
-
-// NOTE: any new packages that host goconvey packages will need to be added here!
-// An alternative is to scan the goconvey directory and then exclude stuff like
-// the examples package but that's nasty too.
-var internalPackages = []string{
- "goconvey/assertions",
- "goconvey/convey",
- "goconvey/execution",
- "goconvey/gotest",
- "goconvey/reporting",
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go
deleted file mode 100644
index c3ccd056..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/statistics.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package reporting
-
-import (
- "fmt"
- "sync"
-)
-
-func (self *statistics) BeginStory(story *StoryReport) {}
-
-func (self *statistics) Enter(scope *ScopeReport) {}
-
-func (self *statistics) Report(report *AssertionResult) {
- self.Lock()
- defer self.Unlock()
-
- if !self.failing && report.Failure != "" {
- self.failing = true
- }
- if !self.erroring && report.Error != nil {
- self.erroring = true
- }
- if report.Skipped {
- self.skipped += 1
- } else {
- self.total++
- }
-}
-
-func (self *statistics) Exit() {}
-
-func (self *statistics) EndStory() {
- self.Lock()
- defer self.Unlock()
-
- if !self.suppressed {
- self.printSummaryLocked()
- }
-}
-
-func (self *statistics) Suppress() {
- self.Lock()
- defer self.Unlock()
- self.suppressed = true
-}
-
-func (self *statistics) PrintSummary() {
- self.Lock()
- defer self.Unlock()
- self.printSummaryLocked()
-}
-
-func (self *statistics) printSummaryLocked() {
- self.reportAssertionsLocked()
- self.reportSkippedSectionsLocked()
- self.completeReportLocked()
-}
-func (self *statistics) reportAssertionsLocked() {
- self.decideColorLocked()
- self.out.Print("\n%d total %s", self.total, plural("assertion", self.total))
-}
-func (self *statistics) decideColorLocked() {
- if self.failing && !self.erroring {
- fmt.Print(yellowColor)
- } else if self.erroring {
- fmt.Print(redColor)
- } else {
- fmt.Print(greenColor)
- }
-}
-func (self *statistics) reportSkippedSectionsLocked() {
- if self.skipped > 0 {
- fmt.Print(yellowColor)
- self.out.Print(" (one or more sections skipped)")
- }
-}
-func (self *statistics) completeReportLocked() {
- fmt.Print(resetColor)
- self.out.Print("\n")
- self.out.Print("\n")
-}
-
-func (self *statistics) Write(content []byte) (written int, err error) {
- return len(content), nil // no-op
-}
-
-func NewStatisticsReporter(out *Printer) *statistics {
- self := statistics{}
- self.out = out
- return &self
-}
-
-type statistics struct {
- sync.Mutex
-
- out *Printer
- total int
- failing bool
- erroring bool
- skipped int
- suppressed bool
-}
-
-func plural(word string, count int) string {
- if count == 1 {
- return word
- }
- return word + "s"
-}
diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/story.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/story.go
deleted file mode 100644
index 9e73c971..00000000
--- a/vendor/github.com/smartystreets/goconvey/convey/reporting/story.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// TODO: in order for this reporter to be completely honest
-// we need to retrofit to be more like the json reporter such that:
-// 1. it maintains ScopeResult collections, which count assertions
-// 2. it reports only after EndStory(), so that all tick marks
-// are placed near the appropriate title.
-// 3. Under unit test
-
-package reporting
-
-import (
- "fmt"
- "strings"
-)
-
-type story struct {
- out *Printer
- titlesById map[string]string
- currentKey []string
-}
-
-func (self *story) BeginStory(story *StoryReport) {}
-
-func (self *story) Enter(scope *ScopeReport) {
- self.out.Indent()
-
- self.currentKey = append(self.currentKey, scope.Title)
- ID := strings.Join(self.currentKey, "|")
-
- if _, found := self.titlesById[ID]; !found {
- self.out.Println("")
- self.out.Print(scope.Title)
- self.out.Insert(" ")
- self.titlesById[ID] = scope.Title
- }
-}
-
-func (self *story) Report(report *AssertionResult) {
- if report.Error != nil {
- fmt.Print(redColor)
- self.out.Insert(error_)
- } else if report.Failure != "" {
- fmt.Print(yellowColor)
- self.out.Insert(failure)
- } else if report.Skipped {
- fmt.Print(yellowColor)
- self.out.Insert(skip)
- } else {
- fmt.Print(greenColor)
- self.out.Insert(success)
- }
- fmt.Print(resetColor)
-}
-
-func (self *story) Exit() {
- self.out.Dedent()
- self.currentKey = self.currentKey[:len(self.currentKey)-1]
-}
-
-func (self *story) EndStory() {
- self.titlesById = make(map[string]string)
- self.out.Println("\n")
-}
-
-func (self *story) Write(content []byte) (written int, err error) {
- return len(content), nil // no-op
-}
-
-func NewStoryReporter(out *Printer) *story {
- self := new(story)
- self.out = out
- self.titlesById = make(map[string]string)
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/dependencies.go b/vendor/github.com/smartystreets/goconvey/dependencies.go
deleted file mode 100644
index 0839e27f..00000000
--- a/vendor/github.com/smartystreets/goconvey/dependencies.go
+++ /dev/null
@@ -1,4 +0,0 @@
-package main
-
-import _ "github.com/jtolds/gls"
-import _ "github.com/smartystreets/assertions"
diff --git a/vendor/github.com/smartystreets/goconvey/go.mod b/vendor/github.com/smartystreets/goconvey/go.mod
deleted file mode 100644
index 5764a0a3..00000000
--- a/vendor/github.com/smartystreets/goconvey/go.mod
+++ /dev/null
@@ -1,8 +0,0 @@
-module github.com/smartystreets/goconvey
-
-require (
- github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
- github.com/jtolds/gls v4.20.0+incompatible
- github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
- golang.org/x/tools v0.0.0-20190328211700-ab21143f2384
-)
diff --git a/vendor/github.com/smartystreets/goconvey/go.sum b/vendor/github.com/smartystreets/goconvey/go.sum
deleted file mode 100644
index 4267185d..00000000
--- a/vendor/github.com/smartystreets/goconvey/go.sum
+++ /dev/null
@@ -1,12 +0,0 @@
-github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
-github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
-github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
-github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
-github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
-golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
diff --git a/vendor/github.com/smartystreets/goconvey/goconvey.go b/vendor/github.com/smartystreets/goconvey/goconvey.go
deleted file mode 100644
index 2e1be674..00000000
--- a/vendor/github.com/smartystreets/goconvey/goconvey.go
+++ /dev/null
@@ -1,293 +0,0 @@
-// This executable provides an HTTP server that watches for file system changes
-// to .go files within the working directory (and all nested go packages).
-// Navigating to the configured host and port in a web browser will display the
-// latest results of running `go test` in each go package.
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "net"
- "net/http"
- "os"
- "os/exec"
- "path/filepath"
- "regexp"
- "runtime"
- "strconv"
- "strings"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/api"
- "github.com/smartystreets/goconvey/web/server/contract"
- "github.com/smartystreets/goconvey/web/server/executor"
- "github.com/smartystreets/goconvey/web/server/messaging"
- "github.com/smartystreets/goconvey/web/server/parser"
- "github.com/smartystreets/goconvey/web/server/system"
- "github.com/smartystreets/goconvey/web/server/watch"
-)
-
-func init() {
- flags()
- folders()
-}
-func flags() {
- flag.IntVar(&port, "port", 8080, "The port at which to serve http.")
- flag.StringVar(&host, "host", "127.0.0.1", "The host at which to serve http.")
- flag.DurationVar(&nap, "poll", quarterSecond, "The interval to wait between polling the file system for changes.")
- flag.IntVar(&parallelPackages, "packages", 10, "The number of packages to test in parallel. Higher == faster but more costly in terms of computing.")
- flag.StringVar(&gobin, "gobin", "go", "The path to the 'go' binary (default: search on the PATH).")
- flag.BoolVar(&cover, "cover", true, "Enable package-level coverage statistics. Requires Go 1.2+ and the go cover tool.")
- flag.IntVar(&depth, "depth", -1, "The directory scanning depth. If -1, scan infinitely deep directory structures. 0: scan working directory. 1+: Scan into nested directories, limited to value.")
- flag.StringVar(&timeout, "timeout", "0", "The test execution timeout if none is specified in the *.goconvey file (default is '0', which is the same as not providing this option).")
- flag.StringVar(&watchedSuffixes, "watchedSuffixes", ".go", "A comma separated list of file suffixes to watch for modifications.")
- flag.StringVar(&excludedDirs, "excludedDirs", "vendor,node_modules", "A comma separated list of directories that will be excluded from being watched")
- flag.StringVar(&workDir, "workDir", "", "set goconvey working directory (default current directory)")
- flag.BoolVar(&autoLaunchBrowser, "launchBrowser", true, "toggle auto launching of browser (default: true)")
-
- log.SetOutput(os.Stdout)
- log.SetFlags(log.LstdFlags | log.Lshortfile)
-}
-func folders() {
- _, file, _, _ := runtime.Caller(0)
- here := filepath.Dir(file)
- static = filepath.Join(here, "/web/client")
- reports = filepath.Join(static, "reports")
-}
-
-func main() {
- flag.Parse()
- log.Printf(initialConfiguration, host, port, nap, cover)
-
- working := getWorkDir()
- cover = coverageEnabled(cover, reports)
- shell := system.NewShell(gobin, reports, cover, timeout)
-
- watcherInput := make(chan messaging.WatcherCommand)
- watcherOutput := make(chan messaging.Folders)
- excludedDirItems := strings.Split(excludedDirs, `,`)
- watcher := watch.NewWatcher(working, depth, nap, watcherInput, watcherOutput, watchedSuffixes, excludedDirItems)
-
- parser := parser.NewParser(parser.ParsePackageResults)
- tester := executor.NewConcurrentTester(shell)
- tester.SetBatchSize(parallelPackages)
-
- longpollChan := make(chan chan string)
- executor := executor.NewExecutor(tester, parser, longpollChan)
- server := api.NewHTTPServer(working, watcherInput, executor, longpollChan)
- listener := createListener()
- go runTestOnUpdates(watcherOutput, executor, server)
- go watcher.Listen()
- if autoLaunchBrowser {
- go launchBrowser(listener.Addr().String())
- }
- serveHTTP(server, listener)
-}
-
-func browserCmd() (string, bool) {
- browser := map[string]string{
- "darwin": "open",
- "linux": "xdg-open",
- "windows": "start",
- }
- cmd, ok := browser[runtime.GOOS]
- return cmd, ok
-}
-
-func launchBrowser(addr string) {
- browser, ok := browserCmd()
- if !ok {
- log.Printf("Skipped launching browser for this OS: %s", runtime.GOOS)
- return
- }
-
- log.Printf("Launching browser on %s", addr)
- url := fmt.Sprintf("http://%s", addr)
- cmd := exec.Command(browser, url)
-
- output, err := cmd.CombinedOutput()
- if err != nil {
- log.Println(err)
- }
- log.Println(string(output))
-}
-
-func runTestOnUpdates(queue chan messaging.Folders, executor contract.Executor, server contract.Server) {
- for update := range queue {
- log.Println("Received request from watcher to execute tests...")
- packages := extractPackages(update)
- output := executor.ExecuteTests(packages)
- root := extractRoot(update, packages)
- server.ReceiveUpdate(root, output)
- }
-}
-
-func extractPackages(folderList messaging.Folders) []*contract.Package {
- packageList := []*contract.Package{}
- for _, folder := range folderList {
- hasImportCycle := testFilesImportTheirOwnPackage(folder.Path)
- packageName := resolvePackageName(folder.Path)
- packageList = append(
- packageList,
- contract.NewPackage(folder, packageName, hasImportCycle),
- )
- }
- return packageList
-}
-
-func extractRoot(folderList messaging.Folders, packageList []*contract.Package) string {
- path := packageList[0].Path
- folder := folderList[path]
- return folder.Root
-}
-
-func createListener() net.Listener {
- l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", host, port))
- if err != nil {
- log.Println(err)
- }
- if l == nil {
- os.Exit(1)
- }
- return l
-}
-
-func serveHTTP(server contract.Server, listener net.Listener) {
- serveStaticResources()
- serveAjaxMethods(server)
- activateServer(listener)
-}
-
-func serveStaticResources() {
- http.Handle("/", http.FileServer(http.Dir(static)))
-}
-
-func serveAjaxMethods(server contract.Server) {
- http.HandleFunc("/watch", server.Watch)
- http.HandleFunc("/ignore", server.Ignore)
- http.HandleFunc("/reinstate", server.Reinstate)
- http.HandleFunc("/latest", server.Results)
- http.HandleFunc("/execute", server.Execute)
- http.HandleFunc("/status", server.Status)
- http.HandleFunc("/status/poll", server.LongPollStatus)
- http.HandleFunc("/pause", server.TogglePause)
-}
-
-func activateServer(listener net.Listener) {
- log.Printf("Serving HTTP at: http://%s\n", listener.Addr())
- err := http.Serve(listener, nil)
- if err != nil {
- log.Println(err)
- }
-}
-
-func coverageEnabled(cover bool, reports string) bool {
- return (cover &&
- goMinVersion(1, 2) &&
- coverToolInstalled() &&
- ensureReportDirectoryExists(reports))
-}
-func goMinVersion(wanted ...int) bool {
- version := runtime.Version() // 'go1.2....'
- s := regexp.MustCompile(`go([\d]+)\.([\d]+)\.?([\d]+)?`).FindAllStringSubmatch(version, 1)
- if len(s) == 0 {
- log.Printf("Cannot determine if newer than go1.2, disabling coverage.")
- return false
- }
- for idx, str := range s[0][1:] {
- if len(wanted) == idx {
- break
- }
- if v, _ := strconv.Atoi(str); v < wanted[idx] {
- log.Printf(pleaseUpgradeGoVersion, version)
- return false
- }
- }
- return true
-}
-func coverToolInstalled() bool {
- working := getWorkDir()
- command := system.NewCommand(working, "go", "tool", "cover").Execute()
- installed := strings.Contains(command.Output, "Usage of 'go tool cover':")
- if !installed {
- log.Print(coverToolMissing)
- return false
- }
- return true
-}
-func ensureReportDirectoryExists(reports string) bool {
- result, err := exists(reports)
- if err != nil {
- log.Fatal(err)
- }
- if result {
- return true
- }
-
- if err := os.Mkdir(reports, 0755); err == nil {
- return true
- }
-
- log.Printf(reportDirectoryUnavailable, reports)
- return false
-}
-func exists(path string) (bool, error) {
- _, err := os.Stat(path)
- if err == nil {
- return true, nil
- }
- if os.IsNotExist(err) {
- return false, nil
- }
- return false, err
-}
-func getWorkDir() string {
- working := ""
- var err error
- if workDir != "" {
- working = workDir
- } else {
- working, err = os.Getwd()
- if err != nil {
- log.Fatal(err)
- }
- }
- result, err := exists(working)
- if err != nil {
- log.Fatal(err)
- }
- if !result {
- log.Fatalf("Path:%s does not exists", working)
- }
- return working
-}
-
-var (
- port int
- host string
- gobin string
- nap time.Duration
- parallelPackages int
- cover bool
- depth int
- timeout string
- watchedSuffixes string
- excludedDirs string
- autoLaunchBrowser bool
-
- static string
- reports string
-
- quarterSecond = time.Millisecond * 250
- workDir string
-)
-
-const (
- initialConfiguration = "Initial configuration: [host: %s] [port: %d] [poll: %v] [cover: %v]\n"
- pleaseUpgradeGoVersion = "Go version is less that 1.2 (%s), please upgrade to the latest stable version to enable coverage reporting.\n"
- coverToolMissing = "Go cover tool is not installed or not accessible: for Go < 1.5 run`go get golang.org/x/tools/cmd/cover`\n For >= Go 1.5 run `go install $GOROOT/src/cmd/cover`\n"
- reportDirectoryUnavailable = "Could not find or create the coverage report directory (at: '%s'). You probably won't see any coverage statistics...\n"
- separator = string(filepath.Separator)
- endGoPath = separator + "src" + separator
-)
diff --git a/vendor/github.com/smartystreets/goconvey/goconvey_1_8.go b/vendor/github.com/smartystreets/goconvey/goconvey_1_8.go
deleted file mode 100644
index a40694c2..00000000
--- a/vendor/github.com/smartystreets/goconvey/goconvey_1_8.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build !go1.9
-
-// To work correctly with out of GOPATH modules, some functions needed to
-// switch from using go/build to golang.org/x/tools/go/packages. But that
-// package depends on changes to go/types that were introduced in Go 1.9. Since
-// modules weren't introduced until Go 1.11, users of Go 1.8 or below can't be
-// using modules, so they can continue to use go/build.
-
-package main
-
-import (
- "go/build"
- "strings"
-)
-
-// This method exists because of a bug in the go cover tool that
-// causes an infinite loop when you try to run `go test -cover`
-// on a package that has an import cycle defined in one of it's
-// test files. Yuck.
-func testFilesImportTheirOwnPackage(packagePath string) bool {
- meta, err := build.ImportDir(packagePath, build.AllowBinary)
- if err != nil {
- return false
- }
-
- for _, dependency := range meta.TestImports {
- if dependency == meta.ImportPath {
- return true
- }
- }
- return false
-}
-
-func resolvePackageName(path string) string {
- pkg, err := build.ImportDir(path, build.FindOnly)
- if err == nil {
- return pkg.ImportPath
- }
-
- nameArr := strings.Split(path, endGoPath)
- return nameArr[len(nameArr)-1]
-}
diff --git a/vendor/github.com/smartystreets/goconvey/goconvey_1_9.go b/vendor/github.com/smartystreets/goconvey/goconvey_1_9.go
deleted file mode 100644
index 9a5c0bd9..00000000
--- a/vendor/github.com/smartystreets/goconvey/goconvey_1_9.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// +build go1.9
-
-// To work correctly with out of GOPATH modules, some functions needed to
-// switch from using go/build to golang.org/x/tools/go/packages. But that
-// package depends on changes to go/types that were introduced in Go 1.9. Since
-// modules weren't introduced until Go 1.11, using
-// golang.org/x/tools/go/packages can safely be restricted to users of Go 1.9
-// or above.
-package main
-
-import (
- "fmt"
- "strings"
-
- "golang.org/x/tools/go/packages"
-)
-
-// This method exists because of a bug in the go cover tool that
-// causes an infinite loop when you try to run `go test -cover`
-// on a package that has an import cycle defined in one of it's
-// test files. Yuck.
-func testFilesImportTheirOwnPackage(packagePath string) bool {
- meta, err := packages.Load(
- &packages.Config{
- Mode: packages.NeedName | packages.NeedImports,
- Tests: true,
- },
- packagePath,
- )
- if err != nil {
- return false
- }
-
- testPackageID := fmt.Sprintf("%s [%s.test]", meta[0], meta[0])
-
- for _, testPackage := range meta[1:] {
- if testPackage.ID != testPackageID {
- continue
- }
-
- for dependency := range testPackage.Imports {
- if dependency == meta[0].PkgPath {
- return true
- }
- }
- break
- }
- return false
-}
-
-func resolvePackageName(path string) string {
- pkg, err := packages.Load(
- &packages.Config{
- Mode: packages.NeedName,
- },
- path,
- )
- if err == nil {
- return pkg[0].PkgPath
- }
-
- nameArr := strings.Split(path, endGoPath)
- return nameArr[len(nameArr)-1]
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/api/api.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/api/server.go b/vendor/github.com/smartystreets/goconvey/web/server/api/server.go
deleted file mode 100644
index 6cea26da..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/api/server.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package api
-
-import (
- "encoding/json"
- "fmt"
- "net/http"
- "os"
- "strconv"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/contract"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-type HTTPServer struct {
- watcher chan messaging.WatcherCommand
- executor contract.Executor
- latest *contract.CompleteOutput
- currentRoot string
- longpoll chan chan string
- paused bool
-}
-
-func (self *HTTPServer) ReceiveUpdate(root string, update *contract.CompleteOutput) {
- self.currentRoot = root
- self.latest = update
-}
-
-func (self *HTTPServer) Watch(response http.ResponseWriter, request *http.Request) {
- if request.Method == "POST" {
- self.adjustRoot(response, request)
- } else if request.Method == "GET" {
- response.Write([]byte(self.currentRoot))
- }
-}
-
-func (self *HTTPServer) adjustRoot(response http.ResponseWriter, request *http.Request) {
- newRoot := self.parseQueryString("root", response, request)
- if newRoot == "" {
- return
- }
- info, err := os.Stat(newRoot) // TODO: how to unit test?
- if !info.IsDir() || err != nil {
- http.Error(response, err.Error(), http.StatusNotFound)
- return
- }
-
- self.watcher <- messaging.WatcherCommand{
- Instruction: messaging.WatcherAdjustRoot,
- Details: newRoot,
- }
-}
-
-func (self *HTTPServer) Ignore(response http.ResponseWriter, request *http.Request) {
- paths := self.parseQueryString("paths", response, request)
- if paths != "" {
- self.watcher <- messaging.WatcherCommand{
- Instruction: messaging.WatcherIgnore,
- Details: paths,
- }
- }
-}
-
-func (self *HTTPServer) Reinstate(response http.ResponseWriter, request *http.Request) {
- paths := self.parseQueryString("paths", response, request)
- if paths != "" {
- self.watcher <- messaging.WatcherCommand{
- Instruction: messaging.WatcherReinstate,
- Details: paths,
- }
- }
-}
-
-func (self *HTTPServer) parseQueryString(key string, response http.ResponseWriter, request *http.Request) string {
- value := request.URL.Query()[key]
-
- if len(value) == 0 {
- http.Error(response, fmt.Sprintf("No '%s' query string parameter included!", key), http.StatusBadRequest)
- return ""
- }
-
- path := value[0]
- if path == "" {
- http.Error(response, "You must provide a non-blank path.", http.StatusBadRequest)
- }
- return path
-}
-
-func (self *HTTPServer) Status(response http.ResponseWriter, request *http.Request) {
- status := self.executor.Status()
- response.Write([]byte(status))
-}
-
-func (self *HTTPServer) LongPollStatus(response http.ResponseWriter, request *http.Request) {
- if self.executor.ClearStatusFlag() {
- response.Write([]byte(self.executor.Status()))
- return
- }
-
- timeout, err := strconv.Atoi(request.URL.Query().Get("timeout"))
- if err != nil || timeout > 180000 || timeout < 0 {
- timeout = 60000 // default timeout is 60 seconds
- }
-
- myReqChan := make(chan string)
-
- select {
- case self.longpoll <- myReqChan: // this case means the executor's status is changing
- case <-time.After(time.Duration(timeout) * time.Millisecond): // this case means the executor hasn't changed status
- return
- }
-
- out := <-myReqChan
-
- if out != "" { // TODO: Why is this check necessary? Sometimes it writes empty string...
- response.Write([]byte(out))
- }
-}
-
-func (self *HTTPServer) Results(response http.ResponseWriter, request *http.Request) {
- response.Header().Set("Content-Type", "application/json")
- response.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
- response.Header().Set("Pragma", "no-cache")
- response.Header().Set("Expires", "0")
- if self.latest != nil {
- self.latest.Paused = self.paused
- }
- stuff, _ := json.Marshal(self.latest)
- response.Write(stuff)
-}
-
-func (self *HTTPServer) Execute(response http.ResponseWriter, request *http.Request) {
- go self.execute()
-}
-
-func (self *HTTPServer) execute() {
- self.watcher <- messaging.WatcherCommand{Instruction: messaging.WatcherExecute}
-}
-
-func (self *HTTPServer) TogglePause(response http.ResponseWriter, request *http.Request) {
- instruction := messaging.WatcherPause
- if self.paused {
- instruction = messaging.WatcherResume
- }
-
- self.watcher <- messaging.WatcherCommand{Instruction: instruction}
- self.paused = !self.paused
-
- fmt.Fprint(response, self.paused) // we could write out whatever helps keep the UI honest...
-}
-
-func NewHTTPServer(
- root string,
- watcher chan messaging.WatcherCommand,
- executor contract.Executor,
- status chan chan string) *HTTPServer {
-
- self := new(HTTPServer)
- self.currentRoot = root
- self.watcher = watcher
- self.executor = executor
- self.longpoll = status
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go b/vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go
deleted file mode 100644
index e758f3e1..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/contract/contracts.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package contract
-
-import "net/http"
-
-type (
- Server interface {
- ReceiveUpdate(root string, update *CompleteOutput)
- Watch(writer http.ResponseWriter, request *http.Request)
- Ignore(writer http.ResponseWriter, request *http.Request)
- Reinstate(writer http.ResponseWriter, request *http.Request)
- Status(writer http.ResponseWriter, request *http.Request)
- LongPollStatus(writer http.ResponseWriter, request *http.Request)
- Results(writer http.ResponseWriter, request *http.Request)
- Execute(writer http.ResponseWriter, request *http.Request)
- TogglePause(writer http.ResponseWriter, request *http.Request)
- }
-
- Executor interface {
- ExecuteTests([]*Package) *CompleteOutput
- Status() string
- ClearStatusFlag() bool
- }
-
- Shell interface {
- GoTest(directory, packageName string, tags, arguments []string) (output string, err error)
- }
-)
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/contract/result.go b/vendor/github.com/smartystreets/goconvey/web/server/contract/result.go
deleted file mode 100644
index 8feef715..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/contract/result.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package contract
-
-import (
- "github.com/smartystreets/goconvey/convey/reporting"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-type Package struct {
- Path string
- Name string
- Ignored bool
- Disabled bool
- BuildTags []string
- TestArguments []string
- Error error
- Output string
- Result *PackageResult
-
- HasImportCycle bool
-}
-
-func NewPackage(folder *messaging.Folder, name string, hasImportCycle bool) *Package {
- self := new(Package)
- self.Path = folder.Path
- self.Name = name
- self.Result = NewPackageResult(self.Name)
- self.Ignored = folder.Ignored
- self.Disabled = folder.Disabled
- self.BuildTags = folder.BuildTags
- self.TestArguments = folder.TestArguments
- self.HasImportCycle = hasImportCycle
- return self
-}
-
-func (self *Package) Active() bool {
- return !self.Disabled && !self.Ignored
-}
-
-func (self *Package) HasUsableResult() bool {
- return self.Active() && (self.Error == nil || (self.Output != ""))
-}
-
-type CompleteOutput struct {
- Packages []*PackageResult
- Revision string
- Paused bool
-}
-
-var ( // PackageResult.Outcome values:
- Ignored = "ignored"
- Disabled = "disabled"
- Passed = "passed"
- Failed = "failed"
- Panicked = "panicked"
- BuildFailure = "build failure"
- NoTestFiles = "no test files"
- NoTestFunctions = "no test functions"
- NoGoFiles = "no go code"
-
- TestRunAbortedUnexpectedly = "test run aborted unexpectedly"
-)
-
-type PackageResult struct {
- PackageName string
- Elapsed float64
- Coverage float64
- Outcome string
- BuildOutput string
- TestResults []TestResult
-}
-
-func NewPackageResult(packageName string) *PackageResult {
- self := new(PackageResult)
- self.PackageName = packageName
- self.TestResults = []TestResult{}
- self.Coverage = -1
- return self
-}
-
-type TestResult struct {
- TestName string
- Elapsed float64
- Passed bool
- Skipped bool
- File string
- Line int
- Message string
- Error string
- Stories []reporting.ScopeResult
-
- RawLines []string `json:",omitempty"`
-}
-
-func NewTestResult(testName string) *TestResult {
- self := new(TestResult)
- self.Stories = []reporting.ScopeResult{}
- self.RawLines = []string{}
- self.TestName = testName
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go
deleted file mode 100644
index 209dbca5..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/contract.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package executor
-
-import "github.com/smartystreets/goconvey/web/server/contract"
-
-type Parser interface {
- Parse([]*contract.Package)
-}
-
-type Tester interface {
- SetBatchSize(batchSize int)
- TestAll(folders []*contract.Package)
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go
deleted file mode 100644
index 117dd56d..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/coordinator.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package executor
-
-import (
- "errors"
- "fmt"
- "log"
- "strings"
- "sync"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type concurrentCoordinator struct {
- batchSize int
- queue chan *contract.Package
- folders []*contract.Package
- shell contract.Shell
- waiter sync.WaitGroup
-}
-
-func (self *concurrentCoordinator) ExecuteConcurrently() {
- self.enlistWorkers()
- self.scheduleTasks()
- self.awaitCompletion()
-}
-
-func (self *concurrentCoordinator) enlistWorkers() {
- for i := 0; i < self.batchSize; i++ {
- self.waiter.Add(1)
- go self.worker(i)
- }
-}
-func (self *concurrentCoordinator) worker(id int) {
- for folder := range self.queue {
- packageName := strings.Replace(folder.Name, "\\", "/", -1)
- if !folder.Active() {
- log.Printf("Skipping concurrent execution: %s\n", packageName)
- continue
- }
-
- if folder.HasImportCycle {
- message := fmt.Sprintf("can't load package: import cycle not allowed\npackage %s\n\timports %s", packageName, packageName)
- log.Println(message)
- folder.Output, folder.Error = message, errors.New(message)
- } else {
- log.Printf("Executing concurrent tests: %s\n", packageName)
- folder.Output, folder.Error = self.shell.GoTest(folder.Path, packageName, folder.BuildTags, folder.TestArguments)
- }
- }
- self.waiter.Done()
-}
-
-func (self *concurrentCoordinator) scheduleTasks() {
- for _, folder := range self.folders {
- self.queue <- folder
- }
-}
-
-func (self *concurrentCoordinator) awaitCompletion() {
- close(self.queue)
- self.waiter.Wait()
-}
-
-func newConcurrentCoordinator(folders []*contract.Package, batchSize int, shell contract.Shell) *concurrentCoordinator {
- self := new(concurrentCoordinator)
- self.queue = make(chan *contract.Package)
- self.folders = folders
- self.batchSize = batchSize
- self.shell = shell
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go
deleted file mode 100644
index 887080cc..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package executor
-
-import (
- "log"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-const (
- Idle = "idle"
- Executing = "executing"
-)
-
-type Executor struct {
- tester Tester
- parser Parser
- status string
- statusChan chan chan string
- statusFlag bool
-}
-
-func (self *Executor) Status() string {
- return self.status
-}
-
-func (self *Executor) ClearStatusFlag() bool {
- hasNewStatus := self.statusFlag
- self.statusFlag = false
- return hasNewStatus
-}
-
-func (self *Executor) ExecuteTests(folders []*contract.Package) *contract.CompleteOutput {
- defer func() { self.setStatus(Idle) }()
- self.execute(folders)
- result := self.parse(folders)
- return result
-}
-
-func (self *Executor) execute(folders []*contract.Package) {
- self.setStatus(Executing)
- self.tester.TestAll(folders)
-}
-
-func (self *Executor) parse(folders []*contract.Package) *contract.CompleteOutput {
- result := &contract.CompleteOutput{Revision: now().String()}
- self.parser.Parse(folders)
- for _, folder := range folders {
- result.Packages = append(result.Packages, folder.Result)
- }
- return result
-}
-
-func (self *Executor) setStatus(status string) {
- self.status = status
- self.statusFlag = true
-
-Loop:
- for {
- select {
- case c := <-self.statusChan:
- self.statusFlag = false
- c <- status
- default:
- break Loop
- }
- }
-
- log.Printf("Executor status: '%s'\n", self.status)
-}
-
-func NewExecutor(tester Tester, parser Parser, ch chan chan string) *Executor {
- return &Executor{
- tester: tester,
- parser: parser,
- status: Idle,
- statusChan: ch,
- statusFlag: false,
- }
-}
-
-var now = func() time.Time {
- return time.Now()
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go b/vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go
deleted file mode 100644
index 76f353a5..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/executor/tester.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package executor
-
-import (
- "errors"
- "fmt"
- "log"
- "strings"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type ConcurrentTester struct {
- shell contract.Shell
- batchSize int
-}
-
-func (self *ConcurrentTester) SetBatchSize(batchSize int) {
- self.batchSize = batchSize
- log.Printf("Now configured to test %d packages concurrently.\n", self.batchSize)
-}
-
-func (self *ConcurrentTester) TestAll(folders []*contract.Package) {
- if self.batchSize == 1 {
- self.executeSynchronously(folders)
- } else {
- newConcurrentCoordinator(folders, self.batchSize, self.shell).ExecuteConcurrently()
- }
- return
-}
-
-func (self *ConcurrentTester) executeSynchronously(folders []*contract.Package) {
- for _, folder := range folders {
- packageName := strings.Replace(folder.Name, "\\", "/", -1)
- if !folder.Active() {
- log.Printf("Skipping execution: %s\n", packageName)
- continue
- }
- if folder.HasImportCycle {
- message := fmt.Sprintf("can't load package: import cycle not allowed\npackage %s\n\timports %s", packageName, packageName)
- log.Println(message)
- folder.Output, folder.Error = message, errors.New(message)
- } else {
- log.Printf("Executing tests: %s\n", packageName)
- folder.Output, folder.Error = self.shell.GoTest(folder.Path, packageName, folder.BuildTags, folder.TestArguments)
- }
- }
-}
-
-func NewConcurrentTester(shell contract.Shell) *ConcurrentTester {
- self := new(ConcurrentTester)
- self.shell = shell
- self.batchSize = defaultBatchSize
- return self
-}
-
-const defaultBatchSize = 10
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go b/vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go
deleted file mode 100644
index 7a920911..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/messaging/messages.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package messaging
-
-///////////////////////////////////////////////////////////////////////////////
-
-type WatcherCommand struct {
- Instruction WatcherInstruction
- Details string
-}
-
-type WatcherInstruction int
-
-func (this WatcherInstruction) String() string {
- switch this {
- case WatcherPause:
- return "Pause"
- case WatcherResume:
- return "Resume"
- case WatcherIgnore:
- return "Ignore"
- case WatcherReinstate:
- return "Reinstate"
- case WatcherAdjustRoot:
- return "AdjustRoot"
- case WatcherExecute:
- return "Execute"
- case WatcherStop:
- return "Stop"
- default:
- return "UNKNOWN INSTRUCTION"
- }
-}
-
-const (
- WatcherPause WatcherInstruction = iota
- WatcherResume
- WatcherIgnore
- WatcherReinstate
- WatcherAdjustRoot
- WatcherExecute
- WatcherStop
-)
-
-///////////////////////////////////////////////////////////////////////////////
-
-type Folders map[string]*Folder
-
-type Folder struct {
- Path string // key
- Root string
- Ignored bool
- Disabled bool
- BuildTags []string
- TestArguments []string
-}
-
-///////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go
deleted file mode 100644
index 406cc68c..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/packageParser.go
+++ /dev/null
@@ -1,178 +0,0 @@
-package parser
-
-import (
- "fmt"
- "regexp"
- "sort"
- "strconv"
- "strings"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-var (
- testNamePattern = regexp.MustCompile("^=== RUN:? +(.+)$")
-)
-
-func ParsePackageResults(result *contract.PackageResult, rawOutput string) {
- newOutputParser(result, rawOutput).parse()
-}
-
-type outputParser struct {
- raw string
- lines []string
- result *contract.PackageResult
- tests []*contract.TestResult
-
- // place holders for loops
- line string
- test *contract.TestResult
- testMap map[string]*contract.TestResult
-}
-
-func newOutputParser(result *contract.PackageResult, rawOutput string) *outputParser {
- self := new(outputParser)
- self.raw = strings.TrimSpace(rawOutput)
- self.lines = strings.Split(self.raw, "\n")
- self.result = result
- self.tests = []*contract.TestResult{}
- self.testMap = make(map[string]*contract.TestResult)
- return self
-}
-
-func (self *outputParser) parse() {
- self.separateTestFunctionsAndMetadata()
- self.parseEachTestFunction()
-}
-
-func (self *outputParser) separateTestFunctionsAndMetadata() {
- for _, self.line = range self.lines {
- if self.processNonTestOutput() {
- break
- }
- self.processTestOutput()
- }
-}
-func (self *outputParser) processNonTestOutput() bool {
- if noGoFiles(self.line) {
- self.recordFinalOutcome(contract.NoGoFiles)
-
- } else if buildFailed(self.line) {
- self.recordFinalOutcome(contract.BuildFailure)
-
- } else if noTestFiles(self.line) {
- self.recordFinalOutcome(contract.NoTestFiles)
-
- } else if noTestFunctions(self.line) {
- self.recordFinalOutcome(contract.NoTestFunctions)
-
- } else {
- return false
- }
- return true
-}
-
-func (self *outputParser) recordFinalOutcome(outcome string) {
- self.result.Outcome = outcome
- self.result.BuildOutput = strings.Join(self.lines, "\n")
-}
-
-func (self *outputParser) processTestOutput() {
- self.line = strings.TrimSpace(self.line)
- if isNewTest(self.line) {
- self.registerTestFunction()
-
- } else if isTestResult(self.line) {
- self.recordTestMetadata()
-
- } else if isPackageReport(self.line) {
- self.recordPackageMetadata()
-
- } else {
- self.saveLineForParsingLater()
-
- }
-}
-
-func (self *outputParser) registerTestFunction() {
- testNameReg := testNamePattern.FindStringSubmatch(self.line)
- if len(testNameReg) < 2 { // Test-related lines that aren't about a new test
- return
- }
- self.test = contract.NewTestResult(testNameReg[1])
- self.tests = append(self.tests, self.test)
- self.testMap[self.test.TestName] = self.test
-}
-func (self *outputParser) recordTestMetadata() {
- testName := strings.Split(self.line, " ")[2]
- if test, ok := self.testMap[testName]; ok {
- self.test = test
- self.test.Passed = !strings.HasPrefix(self.line, "--- FAIL: ")
- self.test.Skipped = strings.HasPrefix(self.line, "--- SKIP: ")
- self.test.Elapsed = parseTestFunctionDuration(self.line)
- }
-}
-func (self *outputParser) recordPackageMetadata() {
- if packageFailed(self.line) {
- self.recordTestingOutcome(contract.Failed)
-
- } else if packagePassed(self.line) {
- self.recordTestingOutcome(contract.Passed)
-
- } else if isCoverageSummary(self.line) {
- self.recordCoverageSummary(self.line)
- }
-}
-func (self *outputParser) recordTestingOutcome(outcome string) {
- self.result.Outcome = outcome
- fields := strings.Split(self.line, "\t")
- self.result.PackageName = strings.TrimSpace(fields[1])
- self.result.Elapsed = parseDurationInSeconds(fields[2], 3)
-}
-func (self *outputParser) recordCoverageSummary(summary string) {
- start := len("coverage: ")
- end := strings.Index(summary, "%")
- value := summary[start:end]
- parsed, err := strconv.ParseFloat(value, 64)
- if err != nil {
- self.result.Coverage = -1
- } else {
- self.result.Coverage = parsed
- }
-}
-func (self *outputParser) saveLineForParsingLater() {
- self.line = strings.TrimLeft(self.line, "\t")
- if self.test == nil {
- fmt.Println("Potential error parsing output of", self.result.PackageName, "; couldn't handle this stray line:", self.line)
- return
- }
- self.test.RawLines = append(self.test.RawLines, self.line)
-}
-
-// TestResults is a collection of TestResults that implements sort.Interface.
-type TestResults []contract.TestResult
-
-func (r TestResults) Len() int {
- return len(r)
-}
-
-// Less compares TestResults on TestName
-func (r TestResults) Less(i, j int) bool {
- return r[i].TestName < r[j].TestName
-}
-
-func (r TestResults) Swap(i, j int) {
- r[i], r[j] = r[j], r[i]
-}
-
-func (self *outputParser) parseEachTestFunction() {
- for _, self.test = range self.tests {
- self.test = parseTestOutput(self.test)
- if self.test.Error != "" {
- self.result.Outcome = contract.Panicked
- }
- self.test.RawLines = []string{}
- self.result.TestResults = append(self.result.TestResults, *self.test)
- }
- sort.Sort(TestResults(self.result.TestResults))
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go
deleted file mode 100644
index f6250caf..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package parser
-
-import (
- "log"
-
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type Parser struct {
- parser func(*contract.PackageResult, string)
-}
-
-func (self *Parser) Parse(packages []*contract.Package) {
- for _, p := range packages {
- if p.Active() && p.HasUsableResult() {
- self.parser(p.Result, p.Output)
- } else if p.Ignored {
- p.Result.Outcome = contract.Ignored
- } else if p.Disabled {
- p.Result.Outcome = contract.Disabled
- } else {
- p.Result.Outcome = contract.TestRunAbortedUnexpectedly
- }
- log.Printf("[%s]: %s\n", p.Result.Outcome, p.Name)
- }
-}
-
-func NewParser(helper func(*contract.PackageResult, string)) *Parser {
- self := new(Parser)
- self.parser = helper
- return self
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey
deleted file mode 100644
index 79982854..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey
+++ /dev/null
@@ -1,2 +0,0 @@
-#ignore
--timeout=1s
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go
deleted file mode 100644
index e632ec0e..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/rules.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package parser
-
-import "strings"
-
-func noGoFiles(line string) bool {
- return strings.HasPrefix(line, "can't load package: ") &&
- (strings.Contains(line, ": no buildable Go source files in ") ||
- strings.Contains(line, ": no Go ") ||
- strings.Contains(line, "cannot find module providing package"))
-}
-func buildFailed(line string) bool {
- return strings.HasPrefix(line, "# ") ||
- strings.Contains(line, "cannot find package") ||
- (strings.HasPrefix(line, "can't load package: ") && !strings.Contains(line, ": no Go ")) ||
- (strings.Contains(line, ": found packages ") && strings.Contains(line, ".go) and ") && strings.Contains(line, ".go) in "))
-}
-func noTestFunctions(line string) bool {
- return line == "testing: warning: no tests to run"
-}
-func noTestFiles(line string) bool {
- return strings.HasPrefix(line, "?") && strings.Contains(line, "[no test files]")
-}
-func isNewTest(line string) bool {
- return strings.HasPrefix(line, "=== ")
-}
-func isTestResult(line string) bool {
- return strings.HasPrefix(line, "--- FAIL:") || strings.HasPrefix(line, "--- PASS:") || strings.HasPrefix(line, "--- SKIP:")
-}
-func isPackageReport(line string) bool {
- return (strings.HasPrefix(line, "FAIL") ||
- strings.HasPrefix(line, "exit status") ||
- strings.HasPrefix(line, "PASS") ||
- isCoverageSummary(line) ||
- packagePassed(line))
-}
-
-func packageFailed(line string) bool {
- return strings.HasPrefix(line, "FAIL\t")
-}
-func packagePassed(line string) bool {
- return strings.HasPrefix(line, "ok \t")
-}
-func isCoverageSummary(line string) bool {
- return strings.HasPrefix(line, "coverage: ") && strings.Contains(line, "% of statements")
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go
deleted file mode 100644
index 9fda9802..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/testParser.go
+++ /dev/null
@@ -1,177 +0,0 @@
-package parser
-
-import (
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/smartystreets/goconvey/convey/reporting"
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-type testParser struct {
- test *contract.TestResult
- line string
- index int
- inJson bool
- jsonLines []string
- otherLines []string
-}
-
-func parseTestOutput(test *contract.TestResult) *contract.TestResult {
- parser := newTestParser(test)
- parser.parseTestFunctionOutput()
- return test
-}
-
-func newTestParser(test *contract.TestResult) *testParser {
- self := new(testParser)
- self.test = test
- return self
-}
-
-func (self *testParser) parseTestFunctionOutput() {
- if len(self.test.RawLines) > 0 {
- self.processLines()
- self.deserializeJson()
- self.composeCapturedOutput()
- }
-}
-
-func (self *testParser) processLines() {
- for self.index, self.line = range self.test.RawLines {
- if !self.processLine() {
- break
- }
- }
-}
-
-func (self *testParser) processLine() bool {
- if strings.HasSuffix(self.line, reporting.OpenJson) {
- self.inJson = true
- self.accountForOutputWithoutNewline()
-
- } else if self.line == reporting.CloseJson {
- self.inJson = false
-
- } else if self.inJson {
- self.jsonLines = append(self.jsonLines, self.line)
-
- } else if isPanic(self.line) {
- self.parsePanicOutput()
- return false
-
- } else if isGoTestLogOutput(self.line) {
- self.parseLogLocation()
-
- } else {
- self.otherLines = append(self.otherLines, self.line)
- }
- return true
-}
-
-// If fmt.Print(f) produces output with no \n and that output
-// is that last output before the framework spits out json
-// (which starts with ''>>>>>'') then without this code
-// all of the json is counted as output, not as json to be
-// parsed and displayed by the web UI.
-func (self *testParser) accountForOutputWithoutNewline() {
- prefix := strings.Split(self.line, reporting.OpenJson)[0]
- if prefix != "" {
- self.otherLines = append(self.otherLines, prefix)
- }
-}
-
-func (self *testParser) deserializeJson() {
- formatted := createArrayForJsonItems(self.jsonLines)
- var scopes []reporting.ScopeResult
- err := json.Unmarshal(formatted, &scopes)
- if err != nil {
- panic(fmt.Sprintf(bugReportRequest, err, formatted))
- }
- self.test.Stories = scopes
-}
-func (self *testParser) parsePanicOutput() {
- for index, line := range self.test.RawLines[self.index:] {
- self.parsePanicLocation(index, line)
- self.preserveStackTraceIndentation(index, line)
- }
- self.test.Error = strings.Join(self.test.RawLines, "\n")
-}
-func (self *testParser) parsePanicLocation(index int, line string) {
- if !panicLineHasMetadata(line) {
- return
- }
- metaLine := self.test.RawLines[index+4]
- fields := strings.Split(metaLine, " ")
- fileAndLine := strings.Split(fields[0], ":")
- self.test.File = fileAndLine[0]
- if len(fileAndLine) >= 2 {
- self.test.Line, _ = strconv.Atoi(fileAndLine[1])
- }
-}
-func (self *testParser) preserveStackTraceIndentation(index int, line string) {
- if panicLineShouldBeIndented(index, line) {
- self.test.RawLines[index] = "\t" + line
- }
-}
-func (self *testParser) parseLogLocation() {
- self.otherLines = append(self.otherLines, self.line)
- lineFields := strings.TrimSpace(self.line)
- if strings.HasPrefix(lineFields, "Error Trace:") {
- lineFields = strings.TrimPrefix(lineFields, "Error Trace:")
- }
- fields := strings.Split(lineFields, ":")
- self.test.File = strings.TrimSpace(fields[0])
- self.test.Line, _ = strconv.Atoi(fields[1])
-}
-
-func (self *testParser) composeCapturedOutput() {
- self.test.Message = strings.Join(self.otherLines, "\n")
-}
-
-func createArrayForJsonItems(lines []string) []byte {
- jsonArrayItems := strings.Join(lines, "")
- jsonArrayItems = removeTrailingComma(jsonArrayItems)
- return []byte(fmt.Sprintf("[%s]\n", jsonArrayItems))
-}
-func removeTrailingComma(rawJson string) string {
- if trailingComma(rawJson) {
- return rawJson[:len(rawJson)-1]
- }
- return rawJson
-}
-func trailingComma(value string) bool {
- return strings.HasSuffix(value, ",")
-}
-
-func isGoTestLogOutput(line string) bool {
- return strings.Count(line, ":") == 2
-}
-
-func isPanic(line string) bool {
- return strings.HasPrefix(line, "panic: ")
-}
-
-func panicLineHasMetadata(line string) bool {
- return strings.HasPrefix(line, "goroutine") && strings.Contains(line, "[running]")
-}
-func panicLineShouldBeIndented(index int, line string) bool {
- return strings.Contains(line, "+") || (index > 0 && strings.Contains(line, "panic: "))
-}
-
-const bugReportRequest = `
-Uh-oh! Looks like something went wrong. Please copy the following text and file a bug report at:
-
-https://github.com/smartystreets/goconvey/issues?state=open
-
-======= BEGIN BUG REPORT =======
-
-ERROR: %v
-
-OUTPUT: %s
-
-======= END BUG REPORT =======
-
-`
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/parser/util.go b/vendor/github.com/smartystreets/goconvey/web/server/parser/util.go
deleted file mode 100644
index 474bfa6d..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/parser/util.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package parser
-
-import (
- "math"
- "strings"
- "time"
-)
-
-// parseTestFunctionDuration parses the duration in seconds as a float64
-// from a line of go test output that looks something like this:
-// --- PASS: TestOldSchool_PassesWithMessage (0.03 seconds)
-func parseTestFunctionDuration(line string) float64 {
- line = strings.Replace(line, "(", "", 1)
- line = strings.Replace(line, ")", "", 1)
- fields := strings.Split(line, " ")
- return parseDurationInSeconds(fields[3], 2)
-}
-
-func parseDurationInSeconds(raw string, precision int) float64 {
- elapsed, err := time.ParseDuration(raw)
- if err != nil {
- elapsed, _ = time.ParseDuration(raw + "s")
- }
- return round(elapsed.Seconds(), precision)
-}
-
-// round returns the rounded version of x with precision.
-//
-// Special cases are:
-// round(±0) = ±0
-// round(±Inf) = ±Inf
-// round(NaN) = NaN
-//
-// Why, oh why doesn't the math package come with a round function?
-// Inspiration: http://play.golang.org/p/ZmFfr07oHp
-func round(x float64, precision int) float64 {
- var rounder float64
- pow := math.Pow(10, float64(precision))
- intermediate := x * pow
-
- if intermediate < 0.0 {
- intermediate -= 0.5
- } else {
- intermediate += 0.5
- }
- rounder = float64(int64(intermediate))
-
- return rounder / float64(pow)
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/system/shell.go b/vendor/github.com/smartystreets/goconvey/web/server/system/shell.go
deleted file mode 100644
index 0adb8942..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/system/shell.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package system
-
-import (
- "log"
- "os/exec"
- "path/filepath"
- "regexp"
- "strings"
-)
-
-///////////////////////////////////////////////////////////////////////////////
-// Integration: ///////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-type Shell struct {
- coverage bool
- gobin string
- reportsPath string
- defaultTimeout string
-}
-
-func NewShell(gobin, reportsPath string, coverage bool, defaultTimeout string) *Shell {
- return &Shell{
- coverage: coverage,
- gobin: gobin,
- reportsPath: reportsPath,
- defaultTimeout: defaultTimeout,
- }
-}
-
-func (self *Shell) GoTest(directory, packageName string, tags, arguments []string) (output string, err error) {
- reportFilename := strings.Replace(packageName, "/", "-", -1)
- reportPath := filepath.Join(self.reportsPath, reportFilename)
- reportData := reportPath + ".txt"
- reportHTML := reportPath + ".html"
- tagsArg := "-tags=" + strings.Join(tags, ",")
-
- goconvey := findGoConvey(directory, self.gobin, packageName, tagsArg).Execute()
- compilation := compile(directory, self.gobin, tagsArg).Execute()
- withCoverage := runWithCoverage(compilation, goconvey, self.coverage, reportData, directory, self.gobin, self.defaultTimeout, tagsArg, arguments).Execute()
- final := runWithoutCoverage(compilation, withCoverage, goconvey, directory, self.gobin, self.defaultTimeout, tagsArg, arguments).Execute()
- go generateReports(final, self.coverage, directory, self.gobin, reportData, reportHTML).Execute()
-
- return final.Output, final.Error
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Functional Core:////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-func findGoConvey(directory, gobin, packageName, tagsArg string) Command {
- return NewCommand(directory, gobin, "list", "-f", "'{{.TestImports}}{{.XTestImports}}'", tagsArg, packageName)
-}
-
-func compile(directory, gobin, tagsArg string) Command {
- return NewCommand(directory, gobin, "test", "-i", tagsArg)
-}
-
-func runWithCoverage(compile, goconvey Command, coverage bool, reportPath, directory, gobin, defaultTimeout, tagsArg string, customArguments []string) Command {
- if compile.Error != nil || goconvey.Error != nil {
- return compile
- }
-
- if !coverage {
- return compile
- }
-
- arguments := []string{"test", "-v", "-coverprofile=" + reportPath, tagsArg}
-
- customArgsText := strings.Join(customArguments, "\t")
- if !strings.Contains(customArgsText, "-covermode=") {
- arguments = append(arguments, "-covermode=set")
- }
-
- if !strings.Contains(customArgsText, "-timeout=") {
- arguments = append(arguments, "-timeout="+defaultTimeout)
- }
-
- if strings.Contains(goconvey.Output, goconveyDSLImport) {
- arguments = append(arguments, "-convey-json")
- }
-
- arguments = append(arguments, customArguments...)
-
- return NewCommand(directory, gobin, arguments...)
-}
-
-func runWithoutCoverage(compile, withCoverage, goconvey Command, directory, gobin, defaultTimeout, tagsArg string, customArguments []string) Command {
- if compile.Error != nil {
- return compile
- }
-
- if goconvey.Error != nil {
- log.Println(gopathProblem, goconvey.Output, goconvey.Error)
- return goconvey
- }
-
- if coverageStatementRE.MatchString(withCoverage.Output) {
- return withCoverage
- }
-
- log.Printf("Coverage output: %v", withCoverage.Output)
-
- log.Print("Run without coverage")
-
- arguments := []string{"test", "-v", tagsArg}
- customArgsText := strings.Join(customArguments, "\t")
- if !strings.Contains(customArgsText, "-timeout=") {
- arguments = append(arguments, "-timeout="+defaultTimeout)
- }
-
- if strings.Contains(goconvey.Output, goconveyDSLImport) {
- arguments = append(arguments, "-convey-json")
- }
- arguments = append(arguments, customArguments...)
- return NewCommand(directory, gobin, arguments...)
-}
-
-func generateReports(previous Command, coverage bool, directory, gobin, reportData, reportHTML string) Command {
- if previous.Error != nil {
- return previous
- }
-
- if !coverage {
- return previous
- }
-
- return NewCommand(directory, gobin, "tool", "cover", "-html="+reportData, "-o", reportHTML)
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Imperative Shell: //////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-type Command struct {
- directory string
- executable string
- arguments []string
-
- Output string
- Error error
-}
-
-func NewCommand(directory, executable string, arguments ...string) Command {
- return Command{
- directory: directory,
- executable: executable,
- arguments: arguments,
- }
-}
-
-func (this Command) Execute() Command {
- if len(this.executable) == 0 {
- return this
- }
-
- if len(this.Output) > 0 || this.Error != nil {
- return this
- }
-
- command := exec.Command(this.executable, this.arguments...)
- command.Dir = this.directory
- var rawOutput []byte
- rawOutput, this.Error = command.CombinedOutput()
- this.Output = string(rawOutput)
- return this
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-const goconveyDSLImport = "github.com/smartystreets/goconvey/convey " // note the trailing space: we don't want to target packages nested in the /convey package.
-const gopathProblem = "Please run goconvey from within $GOPATH/src (also, symlinks might be problematic). Output and Error: "
-
-var coverageStatementRE = regexp.MustCompile(`(?m)^coverage: \d+\.\d% of statements(.*)$|^panic: test timed out after `)
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey
deleted file mode 100644
index aa26e8b7..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/system/system.goconvey
+++ /dev/null
@@ -1,3 +0,0 @@
-#ignore
--timeout=1s
--short \ No newline at end of file
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go b/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go
deleted file mode 100644
index 404a25d3..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package watch
-
-import (
- "os"
- "path/filepath"
- "strings"
-
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-///////////////////////////////////////////////////////////////////////////////
-
-func Categorize(items chan *FileSystemItem, root string, watchSuffixes []string) (folders, profiles, goFiles []*FileSystemItem) {
- for item := range items {
- if item.IsFolder && !isHidden(item.Name) && !foundInHiddenDirectory(item, root) {
- folders = append(folders, item)
-
- } else if strings.HasSuffix(item.Name, ".goconvey") && len(item.Name) > len(".goconvey") {
- profiles = append(profiles, item)
-
- } else {
- for _, suffix := range watchSuffixes {
- if strings.HasSuffix(item.Name, suffix) && !isHidden(item.Name) && !foundInHiddenDirectory(item, root) {
- goFiles = append(goFiles, item)
- }
- }
- }
- }
- return folders, profiles, goFiles
-}
-
-func foundInHiddenDirectory(item *FileSystemItem, root string) bool {
- path := item.Path
- if len(path) > len(root) {
- path = path[len(root):]
- }
-
- for _, folder := range strings.Split(filepath.Dir(path), slash) {
- if isHidden(folder) {
- return true
- }
- }
-
- return false
-}
-func isHidden(path string) bool {
- return strings.HasPrefix(path, ".") || strings.HasPrefix(path, "_") || strings.HasPrefix(path, "flymake_")
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func ParseProfile(profile string) (isDisabled bool, tags, arguments []string) {
- lines := strings.Split(profile, "\n")
-
- for _, line := range lines {
- line = strings.TrimSpace(line)
-
- if len(arguments) == 0 && strings.ToLower(line) == "ignore" {
- return true, nil, nil
-
- } else if strings.HasPrefix(line, "-tags=") {
- tags = append(tags, strings.Split(strings.SplitN(line, "=", 2)[1], ",")...)
- continue
-
- } else if len(line) == 0 {
- continue
-
- } else if strings.HasPrefix(line, "#") {
- continue
-
- } else if strings.HasPrefix(line, "//") {
- continue
-
- } else if line == "-cover" || strings.HasPrefix(line, "-coverprofile") {
- continue
-
- } else if line == "-v" {
- continue // Verbose mode is always enabled so there is no need to record it here.
-
- }
-
- arguments = append(arguments, line)
- }
-
- return false, tags, arguments
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func CreateFolders(items []*FileSystemItem) messaging.Folders {
- folders := map[string]*messaging.Folder{}
-
- for _, item := range items {
- folders[item.Path] = &messaging.Folder{Path: item.Path, Root: item.Root}
- }
-
- return folders
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func LimitDepth(folders messaging.Folders, depth int) {
- if depth < 0 {
- return
- }
-
- for path, folder := range folders {
- if strings.Count(path[len(folder.Root):], slash) > depth {
- delete(folders, path)
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func AttachProfiles(folders messaging.Folders, items []*FileSystemItem) {
- for _, profile := range items {
- if folder, exists := folders[filepath.Dir(profile.Path)]; exists {
- folder.Disabled, folder.BuildTags, folder.TestArguments = profile.ProfileDisabled, profile.ProfileTags, profile.ProfileArguments
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func MarkIgnored(folders messaging.Folders, ignored map[string]struct{}) {
- if len(ignored) == 0 {
- return
- }
-
- for _, folder := range folders {
- for ignored := range ignored {
- if !folder.Ignored && strings.HasSuffix(folder.Path, ignored) {
- folder.Ignored = true
- }
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func ActiveFolders(folders messaging.Folders) messaging.Folders {
- var active messaging.Folders = map[string]*messaging.Folder{}
-
- for path, folder := range folders {
- if folder.Ignored || folder.Disabled {
- continue
- }
-
- active[path] = folder
- }
- return active
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func Sum(folders messaging.Folders, items []*FileSystemItem) int64 {
- var sum int64
- for _, item := range items {
- if _, exists := folders[filepath.Dir(item.Path)]; exists {
- sum += item.Size + item.Modified
- }
- }
- return sum
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-const slash = string(os.PathSeparator)
-
-///////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go b/vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go
deleted file mode 100644
index 9d9890d2..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/imperative_shell.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package watch
-
-import (
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
-)
-
-///////////////////////////////////////////////////////////////////////////////
-
-type FileSystemItem struct {
- Root string
- Path string
- Name string
- Size int64
- Modified int64
- IsFolder bool
-
- ProfileDisabled bool
- ProfileTags []string
- ProfileArguments []string
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-func YieldFileSystemItems(root string, excludedDirs []string) chan *FileSystemItem {
- items := make(chan *FileSystemItem)
-
- go func() {
- filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return filepath.SkipDir
- }
-
- if info.IsDir() && strings.HasPrefix(info.Name(), ".") {
- return filepath.SkipDir
- }
-
- basePath := filepath.Base(path)
- for _, item := range excludedDirs {
- if item == basePath && info.IsDir() && item != "" && basePath != "" {
- return filepath.SkipDir
- }
- }
-
- items <- &FileSystemItem{
- Root: root,
- Path: path,
- Name: info.Name(),
- Size: info.Size(),
- Modified: info.ModTime().Unix(),
- IsFolder: info.IsDir(),
- }
-
- return nil
- })
- close(items)
- }()
-
- return items
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-// ReadContents reads files wholesale. This function is only called on files
-// that end in '.goconvey'. These files should be very small, probably not
-// ever more than a few hundred bytes. The ignored errors are ok because in
-// the event of an IO error all that need be returned is an empty string.
-func ReadContents(path string) string {
- file, err := os.Open(path)
- if err != nil {
- return ""
- }
- defer file.Close()
- reader := io.LimitReader(file, 1024*4)
- content, _ := ioutil.ReadAll(reader)
- return string(content)
-}
-
-///////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go b/vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go
deleted file mode 100644
index 9827c043..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/integration.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package watch
-
-import (
- "log"
- "os"
- "strings"
- "sync"
- "time"
-
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-type Watcher struct {
- nap time.Duration
- rootFolder string
- folderDepth int
- ignoredFolders map[string]struct{}
- fileSystemState int64
- paused bool
- stopped bool
- watchSuffixes []string
- excludedDirs []string
-
- input chan messaging.WatcherCommand
- output chan messaging.Folders
-
- lock sync.RWMutex
-}
-
-func NewWatcher(rootFolder string, folderDepth int, nap time.Duration,
- input chan messaging.WatcherCommand, output chan messaging.Folders, watchSuffixes string, excludedDirs []string) *Watcher {
-
- return &Watcher{
- nap: nap,
- rootFolder: rootFolder,
- folderDepth: folderDepth,
- input: input,
- output: output,
- watchSuffixes: strings.Split(watchSuffixes, ","),
- excludedDirs: excludedDirs,
-
- ignoredFolders: make(map[string]struct{}),
- }
-}
-
-func (this *Watcher) Listen() {
- for {
- if this.stopped {
- return
- }
-
- select {
-
- case command := <-this.input:
- this.respond(command)
-
- default:
- if !this.paused {
- this.scan()
- }
- time.Sleep(this.nap)
- }
- }
-}
-
-func (this *Watcher) respond(command messaging.WatcherCommand) {
- switch command.Instruction {
-
- case messaging.WatcherAdjustRoot:
- log.Println("Adjusting root...")
- this.rootFolder = command.Details
- this.execute()
-
- case messaging.WatcherIgnore:
- log.Println("Ignoring specified folders")
- this.ignore(command.Details)
- // Prevent a filesystem change due to the number of active folders changing
- _, checksum := this.gather()
- this.set(checksum)
-
- case messaging.WatcherReinstate:
- log.Println("Reinstating specified folders")
- this.reinstate(command.Details)
- // Prevent a filesystem change due to the number of active folders changing
- _, checksum := this.gather()
- this.set(checksum)
-
- case messaging.WatcherPause:
- log.Println("Pausing watcher...")
- this.paused = true
-
- case messaging.WatcherResume:
- log.Println("Resuming watcher...")
- this.paused = false
-
- case messaging.WatcherExecute:
- log.Println("Gathering folders for immediate execution...")
- this.execute()
-
- case messaging.WatcherStop:
- log.Println("Stopping the watcher...")
- close(this.output)
- this.stopped = true
-
- default:
- log.Println("Unrecognized command from server:", command.Instruction)
- }
-}
-
-func (this *Watcher) execute() {
- folders, _ := this.gather()
- this.sendToExecutor(folders)
-}
-
-func (this *Watcher) scan() {
- folders, checksum := this.gather()
-
- if checksum == this.fileSystemState {
- return
- }
-
- log.Println("File system state modified, publishing current folders...", this.fileSystemState, checksum)
-
- defer this.set(checksum)
- this.sendToExecutor(folders)
-}
-
-func (this *Watcher) gather() (folders messaging.Folders, checksum int64) {
- items := YieldFileSystemItems(this.rootFolder, this.excludedDirs)
- folderItems, profileItems, goFileItems := Categorize(items, this.rootFolder, this.watchSuffixes)
-
- for _, item := range profileItems {
- // TODO: don't even bother if the item's size is over a few hundred bytes...
- contents := ReadContents(item.Path)
- item.ProfileDisabled, item.ProfileTags, item.ProfileArguments = ParseProfile(contents)
- }
-
- folders = CreateFolders(folderItems)
- LimitDepth(folders, this.folderDepth)
- AttachProfiles(folders, profileItems)
- this.protectedRead(func() { MarkIgnored(folders, this.ignoredFolders) })
-
- active := ActiveFolders(folders)
- checksum = int64(len(active))
- checksum += Sum(active, profileItems)
- checksum += Sum(active, goFileItems)
-
- return folders, checksum
-}
-
-func (this *Watcher) set(state int64) {
- this.fileSystemState = state
-}
-
-func (this *Watcher) sendToExecutor(folders messaging.Folders) {
- this.output <- folders
-}
-
-func (this *Watcher) ignore(paths string) {
- this.protectedWrite(func() {
- for _, folder := range strings.Split(paths, string(os.PathListSeparator)) {
- this.ignoredFolders[folder] = struct{}{}
- log.Println("Currently ignored folders:", this.ignoredFolders)
- }
- })
-}
-func (this *Watcher) reinstate(paths string) {
- this.protectedWrite(func() {
- for _, folder := range strings.Split(paths, string(os.PathListSeparator)) {
- delete(this.ignoredFolders, folder)
- }
- })
-}
-func (this *Watcher) protectedWrite(protected func()) {
- this.lock.Lock()
- defer this.lock.Unlock()
- protected()
-}
-func (this *Watcher) protectedRead(protected func()) {
- this.lock.RLock()
- defer this.lock.RUnlock()
- protected()
-}
diff --git a/vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey b/vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey
deleted file mode 100644
index aa26e8b7..00000000
--- a/vendor/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey
+++ /dev/null
@@ -1,3 +0,0 @@
-#ignore
--timeout=1s
--short \ No newline at end of file