Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2018-01-18 02:33:39 +0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2018-01-18 02:33:39 +0300
commit574ff1310bc6733573a16edbf36b67332a19a5a9 (patch)
treec07b68dda96cef5a2ded5eebcb3354f0e5c4a1eb
parentb428a650bfaefdd1e65631dd54d9f455fc60d67c (diff)
parenta7002554e044144df3fe7012a385ed561e57c99c (diff)
Merge branch 'feature/implement-get-lfs-pointers-rpc' into 'master'
Implement GetLFSPointers RPC Closes #922 See merge request gitlab-org/gitaly!543
-rw-r--r--CHANGELOG.md2
-rw-r--r--internal/rubyserver/rubyserver.go8
-rw-r--r--internal/service/blob/lfs_pointers.go57
-rw-r--r--internal/service/blob/lfs_pointers_test.go125
-rw-r--r--internal/service/blob/server.go14
-rw-r--r--internal/service/blob/testhelper_test.go33
-rw-r--r--internal/service/register.go2
-rw-r--r--ruby/Gemfile2
-rw-r--r--ruby/Gemfile.lock4
-rw-r--r--ruby/lib/gitaly_server.rb2
-rw-r--r--ruby/lib/gitaly_server/blob_service.rb28
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_format.go349
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl4
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_forward.go510
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertions.go471
-rw-r--r--vendor/github.com/stretchr/testify/assert/forward_assertions.go2
-rw-r--r--vendor/github.com/stretchr/testify/assert/http_assertions.go59
-rw-r--r--vendor/github.com/stretchr/testify/require/forward_requirements.go2
-rw-r--r--vendor/github.com/stretchr/testify/require/require.go614
-rw-r--r--vendor/github.com/stretchr/testify/require/require_forward.go510
-rw-r--r--vendor/github.com/stretchr/testify/require/requirements.go2
-rw-r--r--vendor/gitlab.com/gitlab-org/gitaly-proto/go/VERSION2
-rw-r--r--vendor/gitlab.com/gitlab-org/gitaly-proto/go/blob.pb.go180
-rw-r--r--vendor/gitlab.com/gitlab-org/gitaly-proto/go/operations.pb.go90
-rw-r--r--vendor/vendor.json22
25 files changed, 2578 insertions, 516 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5df5ef2ec..b6020083b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
UNRELEASED
+- Implement GetLfsPointers RPC
+ https://gitlab.com/gitlab-org/gitaly/merge_requests/543
- Add tempdir package
https://gitlab.com/gitlab-org/gitaly/merge_requests/538
- Fix validation for Repositoryservice::WriteRef
diff --git a/internal/rubyserver/rubyserver.go b/internal/rubyserver/rubyserver.go
index e2930bab0..2f191048e 100644
--- a/internal/rubyserver/rubyserver.go
+++ b/internal/rubyserver/rubyserver.go
@@ -194,6 +194,14 @@ func (s *Server) RemoteServiceClient(ctx context.Context) (pb.RemoteServiceClien
return pb.NewRemoteServiceClient(conn), err
}
+// BlobServiceClient returns a BlobServiceClient instance that is
+// configured to connect to the running Ruby server. This assumes Start()
+// has been called already.
+func (s *Server) BlobServiceClient(ctx context.Context) (pb.BlobServiceClient, error) {
+ conn, err := s.getConnection(ctx)
+ return pb.NewBlobServiceClient(conn), err
+}
+
func (s *Server) getConnection(ctx context.Context) (*grpc.ClientConn, error) {
s.clientConnMu.RLock()
conn := s.clientConn
diff --git a/internal/service/blob/lfs_pointers.go b/internal/service/blob/lfs_pointers.go
new file mode 100644
index 000000000..bc8f0dd56
--- /dev/null
+++ b/internal/service/blob/lfs_pointers.go
@@ -0,0 +1,57 @@
+package blob
+
+import (
+ "fmt"
+
+ "gitlab.com/gitlab-org/gitaly/internal/rubyserver"
+
+ pb "gitlab.com/gitlab-org/gitaly-proto/go"
+
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+)
+
+func (s *server) GetLFSPointers(req *pb.GetLFSPointersRequest, stream pb.BlobService_GetLFSPointersServer) error {
+ ctx := stream.Context()
+
+ if err := validateGetLFSPointersRequest(req); err != nil {
+ return grpc.Errorf(codes.InvalidArgument, "GetLFSPointers: %v", err)
+ }
+
+ client, err := s.BlobServiceClient(ctx)
+ if err != nil {
+ return err
+ }
+
+ clientCtx, err := rubyserver.SetHeaders(ctx, req.GetRepository())
+ if err != nil {
+ return err
+ }
+
+ rubyStream, err := client.GetLFSPointers(clientCtx, req)
+ if err != nil {
+ return err
+ }
+
+ return rubyserver.Proxy(func() error {
+ resp, err := rubyStream.Recv()
+ if err != nil {
+ md := rubyStream.Trailer()
+ stream.SetTrailer(md)
+ return err
+ }
+ return stream.Send(resp)
+ })
+}
+
+func validateGetLFSPointersRequest(req *pb.GetLFSPointersRequest) error {
+ if req.GetRepository() == nil {
+ return fmt.Errorf("empty Repository")
+ }
+
+ if len(req.GetBlobIds()) == 0 {
+ return fmt.Errorf("empty BlobIds")
+ }
+
+ return nil
+}
diff --git a/internal/service/blob/lfs_pointers_test.go b/internal/service/blob/lfs_pointers_test.go
new file mode 100644
index 000000000..8320edaf2
--- /dev/null
+++ b/internal/service/blob/lfs_pointers_test.go
@@ -0,0 +1,125 @@
+package blob
+
+import (
+ "io"
+ "testing"
+
+ "gitlab.com/gitlab-org/gitaly/internal/testhelper"
+
+ pb "gitlab.com/gitlab-org/gitaly-proto/go"
+
+ "github.com/stretchr/testify/require"
+ "google.golang.org/grpc/codes"
+)
+
+func TestSuccessfulGetLFSPointersRequest(t *testing.T) {
+ server, serverSocketPath := runBlobServer(t)
+ defer server.Stop()
+
+ testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ defer cleanupFn()
+
+ client, conn := newBlobClient(t, serverSocketPath)
+ defer conn.Close()
+
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ lfsPointerIds := []string{
+ "0c304a93cb8430108629bbbcaa27db3343299bc0",
+ "f78df813119a79bfbe0442ab92540a61d3ab7ff3",
+ "bab31d249f78fba464d1b75799aad496cc07fa3b",
+ }
+ otherObjectIds := []string{
+ "d5b560e9c17384cf8257347db63167b54e0c97ff", // tree
+ "60ecb67744cb56576c30214ff52294f8ce2def98", // commit
+ }
+
+ expectedLFSPointers := []*pb.LFSPointer{
+ {
+ Size: 133,
+ Data: []byte("version https://git-lfs.github.com/spec/v1\noid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897\nsize 1575078\n\n"),
+ Oid: "0c304a93cb8430108629bbbcaa27db3343299bc0",
+ },
+ {
+ Size: 127,
+ Data: []byte("version https://git-lfs.github.com/spec/v1\noid sha256:f2b0a1e7550e9b718dafc9b525a04879a766de62e4fbdfc46593d47f7ab74636\nsize 20\n"),
+ Oid: "f78df813119a79bfbe0442ab92540a61d3ab7ff3",
+ },
+ {
+ Size: 127,
+ Data: []byte("version https://git-lfs.github.com/spec/v1\noid sha256:bad71f905b60729f502ca339f7c9f001281a3d12c68a5da7f15de8009f4bd63d\nsize 18\n"),
+ Oid: "bab31d249f78fba464d1b75799aad496cc07fa3b",
+ },
+ }
+
+ request := &pb.GetLFSPointersRequest{
+ Repository: testRepo,
+ BlobIds: append(lfsPointerIds, otherObjectIds...),
+ }
+
+ stream, err := client.GetLFSPointers(ctx, request)
+ require.NoError(t, err)
+
+ var receivedLFSPointers []*pb.LFSPointer
+ for {
+ resp, err := stream.Recv()
+ if err == io.EOF {
+ break
+ } else if err != nil {
+ t.Fatal(err)
+ }
+
+ receivedLFSPointers = append(receivedLFSPointers, resp.GetLfsPointers()...)
+ }
+
+ require.ElementsMatch(t, receivedLFSPointers, expectedLFSPointers)
+}
+
+func TestFailedGetLFSPointersRequestDueToValidations(t *testing.T) {
+ server, serverSocketPath := runBlobServer(t)
+ defer server.Stop()
+
+ testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ defer cleanupFn()
+
+ client, conn := newBlobClient(t, serverSocketPath)
+ defer conn.Close()
+
+ testCases := []struct {
+ desc string
+ request *pb.GetLFSPointersRequest
+ code codes.Code
+ }{
+ {
+ desc: "empty Repository",
+ request: &pb.GetLFSPointersRequest{
+ Repository: nil,
+ BlobIds: []string{"f00"},
+ },
+ code: codes.InvalidArgument,
+ },
+ {
+ desc: "empty BlobIds",
+ request: &pb.GetLFSPointersRequest{
+ Repository: testRepo,
+ BlobIds: nil,
+ },
+ code: codes.InvalidArgument,
+ },
+ }
+
+ for _, testCase := range testCases {
+ t.Run(testCase.desc, func(t *testing.T) {
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ stream, err := client.GetLFSPointers(ctx, testCase.request)
+ require.NoError(t, err)
+
+ _, err = stream.Recv()
+ require.NotEqual(t, io.EOF, err)
+ testhelper.AssertGrpcError(t, err, testCase.code, "")
+ })
+ }
+}
diff --git a/internal/service/blob/server.go b/internal/service/blob/server.go
index c7d160d5b..3100a5fa9 100644
--- a/internal/service/blob/server.go
+++ b/internal/service/blob/server.go
@@ -1,10 +1,16 @@
package blob
-import pb "gitlab.com/gitlab-org/gitaly-proto/go"
+import (
+ "gitlab.com/gitlab-org/gitaly/internal/rubyserver"
-type server struct{}
+ pb "gitlab.com/gitlab-org/gitaly-proto/go"
+)
+
+type server struct {
+ *rubyserver.Server
+}
// NewServer creates a new instance of a grpc BlobServer
-func NewServer() pb.BlobServiceServer {
- return &server{}
+func NewServer(rs *rubyserver.Server) pb.BlobServiceServer {
+ return &server{rs}
}
diff --git a/internal/service/blob/testhelper_test.go b/internal/service/blob/testhelper_test.go
index 9a77f4a56..26559f3ae 100644
--- a/internal/service/blob/testhelper_test.go
+++ b/internal/service/blob/testhelper_test.go
@@ -1,10 +1,13 @@
package blob
import (
+ "log"
"net"
+ "os"
"testing"
"time"
+ "gitlab.com/gitlab-org/gitaly/internal/rubyserver"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"google.golang.org/grpc"
@@ -13,8 +16,28 @@ import (
pb "gitlab.com/gitlab-org/gitaly-proto/go"
)
+var rubyServer *rubyserver.Server
+
+func TestMain(m *testing.M) {
+ os.Exit(testMain(m))
+}
+
+func testMain(m *testing.M) int {
+ defer testhelper.MustHaveNoChildProcess()
+
+ var err error
+ testhelper.ConfigureRuby()
+ rubyServer, err = rubyserver.Start()
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer rubyServer.Stop()
+
+ return m.Run()
+}
+
func runBlobServer(t *testing.T) (*grpc.Server, string) {
- server := testhelper.NewTestGrpcServer(t, nil, nil)
+ grpcServer := testhelper.NewTestGrpcServer(t, nil, nil)
serverSocketPath := testhelper.GetTemporaryGitalySocketFileName()
listener, err := net.Listen("unix", serverSocketPath)
@@ -23,12 +46,12 @@ func runBlobServer(t *testing.T) (*grpc.Server, string) {
t.Fatal(err)
}
- pb.RegisterBlobServiceServer(server, NewServer())
- reflection.Register(server)
+ pb.RegisterBlobServiceServer(grpcServer, &server{rubyServer})
+ reflection.Register(grpcServer)
- go server.Serve(listener)
+ go grpcServer.Serve(listener)
- return server, serverSocketPath
+ return grpcServer, serverSocketPath
}
func newBlobClient(t *testing.T, serverSocketPath string) (pb.BlobServiceClient, *grpc.ClientConn) {
diff --git a/internal/service/register.go b/internal/service/register.go
index acaa8f014..c89ae5223 100644
--- a/internal/service/register.go
+++ b/internal/service/register.go
@@ -25,7 +25,7 @@ import (
// RegisterAll will register all the known grpc services with
// the specified grpc service instance
func RegisterAll(grpcServer *grpc.Server, rubyServer *rubyserver.Server) {
- pb.RegisterBlobServiceServer(grpcServer, blob.NewServer())
+ pb.RegisterBlobServiceServer(grpcServer, blob.NewServer(rubyServer))
pb.RegisterCommitServiceServer(grpcServer, commit.NewServer(rubyServer))
pb.RegisterDiffServiceServer(grpcServer, diff.NewServer(rubyServer))
pb.RegisterNamespaceServiceServer(grpcServer, namespace.NewServer())
diff --git a/ruby/Gemfile b/ruby/Gemfile
index a6631f2f2..bbf14c6c8 100644
--- a/ruby/Gemfile
+++ b/ruby/Gemfile
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
gem 'github-linguist', '~> 4.7.0', require: 'linguist'
-gem 'gitaly-proto', '~> 0.72.0', require: 'gitaly'
+gem 'gitaly-proto', '~> 0.75.0', require: 'gitaly'
gem 'activesupport'
gem 'rdoc', '~> 4.2'
gem 'gollum-lib', '~> 4.2', require: false
diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock
index 821ecd1f0..5909509b3 100644
--- a/ruby/Gemfile.lock
+++ b/ruby/Gemfile.lock
@@ -17,7 +17,7 @@ GEM
multipart-post (>= 1.2, < 3)
gemojione (3.3.0)
json
- gitaly-proto (0.72.0)
+ gitaly-proto (0.75.0)
google-protobuf (~> 3.1)
grpc (~> 1.0)
github-linguist (4.7.6)
@@ -136,7 +136,7 @@ PLATFORMS
DEPENDENCIES
activesupport
- gitaly-proto (~> 0.72.0)
+ gitaly-proto (~> 0.75.0)
github-linguist (~> 4.7.0)
gitlab-styles (~> 2.0.0)
gollum-lib (~> 4.2)
diff --git a/ruby/lib/gitaly_server.rb b/ruby/lib/gitaly_server.rb
index c2eb92896..71648a7a6 100644
--- a/ruby/lib/gitaly_server.rb
+++ b/ruby/lib/gitaly_server.rb
@@ -4,6 +4,7 @@ require_relative 'gitlab/git.rb'
require_relative 'gitaly_server/client.rb'
require_relative 'gitaly_server/utils.rb'
+require_relative 'gitaly_server/blob_service.rb'
require_relative 'gitaly_server/commit_service.rb'
require_relative 'gitaly_server/diff_service.rb'
require_relative 'gitaly_server/ref_service.rb'
@@ -49,5 +50,6 @@ module GitalyServer
server.handle(WikiService.new)
server.handle(ConflictsService.new)
server.handle(RemoteService.new)
+ server.handle(BlobService.new)
end
end
diff --git a/ruby/lib/gitaly_server/blob_service.rb b/ruby/lib/gitaly_server/blob_service.rb
new file mode 100644
index 000000000..f1b336edc
--- /dev/null
+++ b/ruby/lib/gitaly_server/blob_service.rb
@@ -0,0 +1,28 @@
+module GitalyServer
+ class BlobService < Gitaly::BlobService::Service
+ include Utils
+
+ def get_lfs_pointers(request, call)
+ bridge_exceptions do
+ repo = Gitlab::Git::Repository.from_gitaly(request.repository, call)
+ blobs = Gitlab::Git::Blob.batch_lfs_pointers(repo, request.blob_ids)
+
+ Enumerator.new do |y|
+ # LFS pointers are maximum 200 bytes in size, and for a default message size of 4 MB
+ # we got more than enough room for 100 blobs.
+ blobs.each_slice(100) do |blobs_slice|
+ lfs_pointers = blobs_slice.map do |blob|
+ Gitaly::LFSPointer.new(
+ size: blob.size,
+ data: blob.data,
+ oid: blob.id
+ )
+ end
+
+ y.yield Gitaly::GetLFSPointersResponse.new(lfs_pointers: lfs_pointers)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go
new file mode 100644
index 000000000..e35541af5
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go
@@ -0,0 +1,349 @@
+/*
+* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
+* THIS FILE MUST NOT BE EDITED BY HAND
+ */
+
+package assert
+
+import (
+ http "net/http"
+ url "net/url"
+ time "time"
+)
+
+// Conditionf uses a Comparison to assert a complex condition.
+func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
+ return Condition(t, comp, append([]interface{}{msg}, args...)...)
+}
+
+// Containsf asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
+// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
+// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
+func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
+ return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
+}
+
+// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
+ return DirExists(t, path, append([]interface{}{msg}, args...)...)
+}
+
+// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted"))
+func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
+ return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
+}
+
+// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// assert.Emptyf(t, obj, "error message %s", "formatted")
+func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
+ return Empty(t, object, append([]interface{}{msg}, args...)...)
+}
+
+// Equalf asserts that two objects are equal.
+//
+// assert.Equalf(t, 123, 123, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
+}
+
+// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
+func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
+ return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
+}
+
+// EqualValuesf asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
+func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
+}
+
+// Errorf asserts that a function returned an error (i.e. not `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.Errorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
+func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
+ return Error(t, err, append([]interface{}{msg}, args...)...)
+}
+
+// Exactlyf asserts that two objects are equal in value and type.
+//
+// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
+func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
+}
+
+// Failf reports a failure through
+func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
+ return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
+}
+
+// FailNowf fails test
+func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
+ return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
+}
+
+// Falsef asserts that the specified value is false.
+//
+// assert.Falsef(t, myBool, "error message %s", "formatted")
+func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
+ return False(t, value, append([]interface{}{msg}, args...)...)
+}
+
+// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
+ return FileExists(t, path, append([]interface{}{msg}, args...)...)
+}
+
+// HTTPBodyContainsf asserts that a specified handler returns a
+// body that contains a string.
+//
+// assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
+ return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
+}
+
+// HTTPBodyNotContainsf asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
+ return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
+}
+
+// HTTPErrorf asserts that a specified handler returns an error status code.
+//
+// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
+ return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
+}
+
+// HTTPRedirectf asserts that a specified handler returns a redirect status code.
+//
+// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
+ return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
+}
+
+// HTTPSuccessf asserts that a specified handler returns a success status code.
+//
+// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
+ return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
+}
+
+// Implementsf asserts that an object is implemented by the specified interface.
+//
+// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
+func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
+ return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
+}
+
+// InDeltaf asserts that the two numerals are within delta of each other.
+//
+// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
+func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
+ return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
+}
+
+// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
+ return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
+}
+
+// InDeltaSlicef is the same as InDelta, except it compares two slices.
+func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
+ return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
+}
+
+// InEpsilonf asserts that expected and actual have a relative error less than epsilon
+func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
+ return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
+}
+
+// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
+func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
+ return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
+}
+
+// IsTypef asserts that the specified objects are of the same type.
+func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
+ return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
+}
+
+// JSONEqf asserts that two JSON strings are equivalent.
+//
+// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
+ return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
+}
+
+// Lenf asserts that the specified object has specific length.
+// Lenf also fails if the object has a type that len() not accept.
+//
+// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
+func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
+ return Len(t, object, length, append([]interface{}{msg}, args...)...)
+}
+
+// Nilf asserts that the specified object is nil.
+//
+// assert.Nilf(t, err, "error message %s", "formatted")
+func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
+ return Nil(t, object, append([]interface{}{msg}, args...)...)
+}
+
+// NoErrorf asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.NoErrorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
+ return NoError(t, err, append([]interface{}{msg}, args...)...)
+}
+
+// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
+func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
+ return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
+}
+
+// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
+func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
+ return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
+}
+
+// NotEqualf asserts that the specified values are NOT equal.
+//
+// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
+}
+
+// NotNilf asserts that the specified object is not nil.
+//
+// assert.NotNilf(t, err, "error message %s", "formatted")
+func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
+ return NotNil(t, object, append([]interface{}{msg}, args...)...)
+}
+
+// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
+func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
+ return NotPanics(t, f, append([]interface{}{msg}, args...)...)
+}
+
+// NotRegexpf asserts that a specified regexp does not match a string.
+//
+// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
+// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
+func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
+ return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
+}
+
+// NotSubsetf asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
+ return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
+}
+
+// NotZerof asserts that i is not the zero value for its type.
+func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
+ return NotZero(t, i, append([]interface{}{msg}, args...)...)
+}
+
+// Panicsf asserts that the code inside the specified PanicTestFunc panics.
+//
+// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
+func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
+ return Panics(t, f, append([]interface{}{msg}, args...)...)
+}
+
+// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
+ return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
+}
+
+// Regexpf asserts that a specified regexp matches a string.
+//
+// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
+// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
+func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
+ return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
+}
+
+// Subsetf asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
+ return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
+}
+
+// Truef asserts that the specified value is true.
+//
+// assert.Truef(t, myBool, "error message %s", "formatted")
+func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
+ return True(t, value, append([]interface{}{msg}, args...)...)
+}
+
+// WithinDurationf asserts that the two times are within duration delta of each other.
+//
+// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
+ return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
+}
+
+// Zerof asserts that i is the zero value for its type.
+func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
+ return Zero(t, i, append([]interface{}{msg}, args...)...)
+}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl
new file mode 100644
index 000000000..c5cc66f43
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl
@@ -0,0 +1,4 @@
+{{.CommentFormat}}
+func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool {
+ return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}})
+}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go
index aa4311ff8..04748be1e 100644
--- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go
+++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go
@@ -16,36 +16,82 @@ func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool
return Condition(a.t, comp, msgAndArgs...)
}
+// Conditionf uses a Comparison to assert a complex condition.
+func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {
+ return Conditionf(a.t, comp, msg, args...)
+}
+
// Contains asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'")
-// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'")
-// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Contains("Hello World", "World")
+// a.Contains(["Hello", "World"], "World")
+// a.Contains({"Hello": "World"}, "Hello")
func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
return Contains(a.t, s, contains, msgAndArgs...)
}
+// Containsf asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// a.Containsf("Hello World", "World", "error message %s", "formatted")
+// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
+// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
+func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
+ return Containsf(a.t, s, contains, msg, args...)
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {
+ return DirExists(a.t, path, msgAndArgs...)
+}
+
+// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {
+ return DirExistsf(a.t, path, msg, args...)
+}
+
+// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]))
+func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {
+ return ElementsMatch(a.t, listA, listB, msgAndArgs...)
+}
+
+// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted"))
+func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
+ return ElementsMatchf(a.t, listA, listB, msg, args...)
+}
+
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// a.Empty(obj)
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
return Empty(a.t, object, msgAndArgs...)
}
-// Equal asserts that two objects are equal.
+// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
//
-// a.Equal(123, 123, "123 and 123 should be equal")
+// a.Emptyf(obj, "error message %s", "formatted")
+func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {
+ return Emptyf(a.t, object, msg, args...)
+}
+
+// Equal asserts that two objects are equal.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Equal(123, 123)
//
// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
return Equal(a.t, expected, actual, msgAndArgs...)
}
@@ -54,44 +100,81 @@ func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs
// and that it is equal to the provided error.
//
// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString, "An error was expected")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.EqualError(err, expectedErrorString)
func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
return EqualError(a.t, theError, errString, msgAndArgs...)
}
+// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
+func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {
+ return EqualErrorf(a.t, theError, errString, msg, args...)
+}
+
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
-// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.EqualValues(uint32(123), int32(123))
func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
return EqualValues(a.t, expected, actual, msgAndArgs...)
}
+// EqualValuesf asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
+func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return EqualValuesf(a.t, expected, actual, msg, args...)
+}
+
+// Equalf asserts that two objects are equal.
+//
+// a.Equalf(123, 123, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return Equalf(a.t, expected, actual, msg, args...)
+}
+
// Error asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
-// if a.Error(err, "An error was expected") {
-// assert.Equal(t, err, expectedError)
+// if a.Error(err) {
+// assert.Equal(t, expectedError, err)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
return Error(a.t, err, msgAndArgs...)
}
-// Exactly asserts that two objects are equal is value and type.
+// Errorf asserts that a function returned an error (i.e. not `nil`).
//
-// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal")
+// actualObj, err := SomeFunction()
+// if a.Errorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
+func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
+ return Errorf(a.t, err, msg, args...)
+}
+
+// Exactly asserts that two objects are equal in value and type.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Exactly(int32(123), int64(123))
func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
return Exactly(a.t, expected, actual, msgAndArgs...)
}
+// Exactlyf asserts that two objects are equal in value and type.
+//
+// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
+func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return Exactlyf(a.t, expected, actual, msg, args...)
+}
+
// Fail reports a failure through
func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {
return Fail(a.t, failureMessage, msgAndArgs...)
@@ -102,23 +185,58 @@ func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) b
return FailNow(a.t, failureMessage, msgAndArgs...)
}
+// FailNowf fails test
+func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {
+ return FailNowf(a.t, failureMessage, msg, args...)
+}
+
+// Failf reports a failure through
+func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {
+ return Failf(a.t, failureMessage, msg, args...)
+}
+
// False asserts that the specified value is false.
//
-// a.False(myBool, "myBool should be false")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.False(myBool)
func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
return False(a.t, value, msgAndArgs...)
}
+// Falsef asserts that the specified value is false.
+//
+// a.Falsef(myBool, "error message %s", "formatted")
+func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
+ return Falsef(a.t, value, msg, args...)
+}
+
+// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {
+ return FileExists(a.t, path, msgAndArgs...)
+}
+
+// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {
+ return FileExistsf(a.t, path, msg, args...)
+}
+
// HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
- return HTTPBodyContains(a.t, handler, method, url, values, str)
+func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
+ return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
+}
+
+// HTTPBodyContainsf asserts that a specified handler returns a
+// body that contains a string.
+//
+// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
+ return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
}
// HTTPBodyNotContains asserts that a specified handler returns a
@@ -127,8 +245,18 @@ func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, u
// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
- return HTTPBodyNotContains(a.t, handler, method, url, values, str)
+func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
+ return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
+}
+
+// HTTPBodyNotContainsf asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
+ return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
}
// HTTPError asserts that a specified handler returns an error status code.
@@ -136,8 +264,17 @@ func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string
// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool {
- return HTTPError(a.t, handler, method, url, values)
+func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
+ return HTTPError(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPErrorf asserts that a specified handler returns an error status code.
+//
+// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
+ return HTTPErrorf(a.t, handler, method, url, values, msg, args...)
}
// HTTPRedirect asserts that a specified handler returns a redirect status code.
@@ -145,8 +282,17 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri
// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool {
- return HTTPRedirect(a.t, handler, method, url, values)
+func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
+ return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPRedirectf asserts that a specified handler returns a redirect status code.
+//
+// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
+ return HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
}
// HTTPSuccess asserts that a specified handler returns a success status code.
@@ -154,34 +300,68 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool {
- return HTTPSuccess(a.t, handler, method, url, values)
+func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
+ return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPSuccessf asserts that a specified handler returns a success status code.
+//
+// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
+ return HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
}
// Implements asserts that an object is implemented by the specified interface.
//
-// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject")
+// a.Implements((*MyInterface)(nil), new(MyObject))
func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
return Implements(a.t, interfaceObject, object, msgAndArgs...)
}
+// Implementsf asserts that an object is implemented by the specified interface.
+//
+// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
+func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
+ return Implementsf(a.t, interfaceObject, object, msg, args...)
+}
+
// InDelta asserts that the two numerals are within delta of each other.
//
// a.InDelta(math.Pi, (22 / 7.0), 0.01)
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
return InDelta(a.t, expected, actual, delta, msgAndArgs...)
}
+// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
+ return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
+}
+
+// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
+ return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
+}
+
// InDeltaSlice is the same as InDelta, except it compares two slices.
func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
}
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
+// InDeltaSlicef is the same as InDelta, except it compares two slices.
+func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
+ return InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
+}
+
+// InDeltaf asserts that the two numerals are within delta of each other.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
+func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
+ return InDeltaf(a.t, expected, actual, delta, msg, args...)
+}
+
+// InEpsilon asserts that expected and actual have a relative error less than epsilon
func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
}
@@ -191,80 +371,133 @@ func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, ep
return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
}
+// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
+func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
+ return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
+}
+
+// InEpsilonf asserts that expected and actual have a relative error less than epsilon
+func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
+ return InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
+}
+
// IsType asserts that the specified objects are of the same type.
func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
return IsType(a.t, expectedType, object, msgAndArgs...)
}
+// IsTypef asserts that the specified objects are of the same type.
+func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
+ return IsTypef(a.t, expectedType, object, msg, args...)
+}
+
// JSONEq asserts that two JSON strings are equivalent.
//
// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {
return JSONEq(a.t, expected, actual, msgAndArgs...)
}
+// JSONEqf asserts that two JSON strings are equivalent.
+//
+// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {
+ return JSONEqf(a.t, expected, actual, msg, args...)
+}
+
// Len asserts that the specified object has specific length.
// Len also fails if the object has a type that len() not accept.
//
-// a.Len(mySlice, 3, "The size of slice is not 3")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Len(mySlice, 3)
func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {
return Len(a.t, object, length, msgAndArgs...)
}
-// Nil asserts that the specified object is nil.
+// Lenf asserts that the specified object has specific length.
+// Lenf also fails if the object has a type that len() not accept.
//
-// a.Nil(err, "err should be nothing")
+// a.Lenf(mySlice, 3, "error message %s", "formatted")
+func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {
+ return Lenf(a.t, object, length, msg, args...)
+}
+
+// Nil asserts that the specified object is nil.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Nil(err)
func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
return Nil(a.t, object, msgAndArgs...)
}
+// Nilf asserts that the specified object is nil.
+//
+// a.Nilf(err, "error message %s", "formatted")
+func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {
+ return Nilf(a.t, object, msg, args...)
+}
+
// NoError asserts that a function returned no error (i.e. `nil`).
//
// actualObj, err := SomeFunction()
// if a.NoError(err) {
-// assert.Equal(t, actualObj, expectedObj)
+// assert.Equal(t, expectedObj, actualObj)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
return NoError(a.t, err, msgAndArgs...)
}
+// NoErrorf asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if a.NoErrorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
+ return NoErrorf(a.t, err, msg, args...)
+}
+
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'")
-// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'")
-// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.NotContains("Hello World", "Earth")
+// a.NotContains(["Hello", "World"], "Earth")
+// a.NotContains({"Hello": "World"}, "Earth")
func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
return NotContains(a.t, s, contains, msgAndArgs...)
}
+// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
+// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
+// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
+func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
+ return NotContainsf(a.t, s, contains, msg, args...)
+}
+
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// if a.NotEmpty(obj) {
// assert.Equal(t, "two", obj[1])
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {
return NotEmpty(a.t, object, msgAndArgs...)
}
-// NotEqual asserts that the specified values are NOT equal.
+// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
//
-// a.NotEqual(obj1, obj2, "two objects shouldn't be equal")
+// if a.NotEmptyf(obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
+func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {
+ return NotEmptyf(a.t, object, msg, args...)
+}
+
+// NotEqual asserts that the specified values are NOT equal.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.NotEqual(obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -272,81 +505,182 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr
return NotEqual(a.t, expected, actual, msgAndArgs...)
}
-// NotNil asserts that the specified object is not nil.
+// NotEqualf asserts that the specified values are NOT equal.
//
-// a.NotNil(err, "err should be something")
+// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
//
-// Returns whether the assertion was successful (true) or not (false).
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
+ return NotEqualf(a.t, expected, actual, msg, args...)
+}
+
+// NotNil asserts that the specified object is not nil.
+//
+// a.NotNil(err)
func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {
return NotNil(a.t, object, msgAndArgs...)
}
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
+// NotNilf asserts that the specified object is not nil.
//
-// a.NotPanics(func(){
-// RemainCalm()
-// }, "Calling RemainCalm() should NOT panic")
+// a.NotNilf(err, "error message %s", "formatted")
+func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {
+ return NotNilf(a.t, object, msg, args...)
+}
+
+// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.NotPanics(func(){ RemainCalm() })
func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
return NotPanics(a.t, f, msgAndArgs...)
}
+// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
+func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
+ return NotPanicsf(a.t, f, msg, args...)
+}
+
// NotRegexp asserts that a specified regexp does not match a string.
//
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
// a.NotRegexp("^start", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
return NotRegexp(a.t, rx, str, msgAndArgs...)
}
-// NotZero asserts that i is not the zero value for its type and returns the truth.
+// NotRegexpf asserts that a specified regexp does not match a string.
+//
+// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
+// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
+func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
+ return NotRegexpf(a.t, rx, str, msg, args...)
+}
+
+// NotSubset asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
+ return NotSubset(a.t, list, subset, msgAndArgs...)
+}
+
+// NotSubsetf asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
+ return NotSubsetf(a.t, list, subset, msg, args...)
+}
+
+// NotZero asserts that i is not the zero value for its type.
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {
return NotZero(a.t, i, msgAndArgs...)
}
+// NotZerof asserts that i is not the zero value for its type.
+func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {
+ return NotZerof(a.t, i, msg, args...)
+}
+
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
-// a.Panics(func(){
-// GoCrazy()
-// }, "Calling GoCrazy() should panic")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Panics(func(){ GoCrazy() })
func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
return Panics(a.t, f, msgAndArgs...)
}
+// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
+func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
+ return PanicsWithValue(a.t, expected, f, msgAndArgs...)
+}
+
+// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
+ return PanicsWithValuef(a.t, expected, f, msg, args...)
+}
+
+// Panicsf asserts that the code inside the specified PanicTestFunc panics.
+//
+// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
+func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
+ return Panicsf(a.t, f, msg, args...)
+}
+
// Regexp asserts that a specified regexp matches a string.
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
return Regexp(a.t, rx, str, msgAndArgs...)
}
-// True asserts that the specified value is true.
+// Regexpf asserts that a specified regexp matches a string.
//
-// a.True(myBool, "myBool should be true")
+// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
+// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
+func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
+ return Regexpf(a.t, rx, str, msg, args...)
+}
+
+// Subset asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
+ return Subset(a.t, list, subset, msgAndArgs...)
+}
+
+// Subsetf asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
+ return Subsetf(a.t, list, subset, msg, args...)
+}
+
+// True asserts that the specified value is true.
+//
+// a.True(myBool)
func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
return True(a.t, value, msgAndArgs...)
}
-// WithinDuration asserts that the two times are within duration delta of each other.
+// Truef asserts that the specified value is true.
//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s")
+// a.Truef(myBool, "error message %s", "formatted")
+func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
+ return Truef(a.t, value, msg, args...)
+}
+
+// WithinDuration asserts that the two times are within duration delta of each other.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
return WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
}
-// Zero asserts that i is the zero value for its type and returns the truth.
+// WithinDurationf asserts that the two times are within duration delta of each other.
+//
+// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
+ return WithinDurationf(a.t, expected, actual, delta, msg, args...)
+}
+
+// Zero asserts that i is the zero value for its type.
func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {
return Zero(a.t, i, msgAndArgs...)
}
+
+// Zerof asserts that i is the zero value for its type.
+func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {
+ return Zerof(a.t, i, msg, args...)
+}
diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go
index d1552e5e3..201555503 100644
--- a/vendor/github.com/stretchr/testify/assert/assertions.go
+++ b/vendor/github.com/stretchr/testify/assert/assertions.go
@@ -4,8 +4,10 @@ import (
"bufio"
"bytes"
"encoding/json"
+ "errors"
"fmt"
"math"
+ "os"
"reflect"
"regexp"
"runtime"
@@ -18,6 +20,8 @@ import (
"github.com/pmezard/go-difflib/difflib"
)
+//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_format.go.tmpl
+
// TestingT is an interface wrapper around *testing.T
type TestingT interface {
Errorf(format string, args ...interface{})
@@ -38,7 +42,15 @@ func ObjectsAreEqual(expected, actual interface{}) bool {
if expected == nil || actual == nil {
return expected == actual
}
-
+ if exp, ok := expected.([]byte); ok {
+ act, ok := actual.([]byte)
+ if !ok {
+ return false
+ } else if exp == nil || act == nil {
+ return exp == nil && act == nil
+ }
+ return bytes.Equal(exp, act)
+ }
return reflect.DeepEqual(expected, actual)
}
@@ -108,10 +120,12 @@ func CallerInfo() []string {
}
parts := strings.Split(file, "/")
- dir := parts[len(parts)-2]
file = parts[len(parts)-1]
- if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" {
- callers = append(callers, fmt.Sprintf("%s:%d", file, line))
+ if len(parts) > 1 {
+ dir := parts[len(parts)-2]
+ if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" {
+ callers = append(callers, fmt.Sprintf("%s:%d", file, line))
+ }
}
// Drop the package
@@ -181,7 +195,7 @@ func indentMessageLines(message string, longestLabelLen int) string {
// no need to align first line because it starts at the correct location (after the label)
if i != 0 {
// append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab
- outBuf.WriteString("\n\r\t" + strings.Repeat(" ", longestLabelLen +1) + "\t")
+ outBuf.WriteString("\n\r\t" + strings.Repeat(" ", longestLabelLen+1) + "\t")
}
outBuf.WriteString(scanner.Text())
}
@@ -218,18 +232,25 @@ func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
{"Error", failureMessage},
}
+ // Add test name if the Go version supports it
+ if n, ok := t.(interface {
+ Name() string
+ }); ok {
+ content = append(content, labeledContent{"Test", n.Name()})
+ }
+
message := messageFromMsgAndArgs(msgAndArgs...)
if len(message) > 0 {
content = append(content, labeledContent{"Messages", message})
}
- t.Errorf("\r" + getWhitespaceString() + labeledOutput(content...))
+ t.Errorf("%s", "\r"+getWhitespaceString()+labeledOutput(content...))
return false
}
type labeledContent struct {
- label string
+ label string
content string
}
@@ -258,17 +279,18 @@ func labeledOutput(content ...labeledContent) string {
// Implements asserts that an object is implemented by the specified interface.
//
-// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject")
+// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
-
interfaceType := reflect.TypeOf(interfaceObject).Elem()
+ if object == nil {
+ return Fail(t, fmt.Sprintf("Cannot check if nil implements %v", interfaceType), msgAndArgs...)
+ }
if !reflect.TypeOf(object).Implements(interfaceType) {
return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...)
}
return true
-
}
// IsType asserts that the specified objects are of the same type.
@@ -283,20 +305,23 @@ func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs
// Equal asserts that two objects are equal.
//
-// assert.Equal(t, 123, 123, "123 and 123 should be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Equal(t, 123, 123)
//
// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
+ if err := validateEqualArgs(expected, actual); err != nil {
+ return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)",
+ expected, actual, err), msgAndArgs...)
+ }
if !ObjectsAreEqual(expected, actual) {
diff := diff(expected, actual)
expected, actual = formatUnequalValues(expected, actual)
return Fail(t, fmt.Sprintf("Not equal: \n"+
"expected: %s\n"+
- "received: %s%s", expected, actual, diff), msgAndArgs...)
+ "actual : %s%s", expected, actual, diff), msgAndArgs...)
}
return true
@@ -322,9 +347,7 @@ func formatUnequalValues(expected, actual interface{}) (e string, a string) {
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
-// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.EqualValues(t, uint32(123), int32(123))
func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
if !ObjectsAreEqualValues(expected, actual) {
@@ -332,18 +355,16 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa
expected, actual = formatUnequalValues(expected, actual)
return Fail(t, fmt.Sprintf("Not equal: \n"+
"expected: %s\n"+
- "received: %s%s", expected, actual, diff), msgAndArgs...)
+ "actual : %s%s", expected, actual, diff), msgAndArgs...)
}
return true
}
-// Exactly asserts that two objects are equal is value and type.
+// Exactly asserts that two objects are equal in value and type.
//
-// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Exactly(t, int32(123), int64(123))
func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
aType := reflect.TypeOf(expected)
@@ -359,9 +380,7 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}
// NotNil asserts that the specified object is not nil.
//
-// assert.NotNil(t, err, "err should be something")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotNil(t, err)
func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
if !isNil(object) {
return true
@@ -386,9 +405,7 @@ func isNil(object interface{}) bool {
// Nil asserts that the specified object is nil.
//
-// assert.Nil(t, err, "err should be nothing")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Nil(t, err)
func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
if isNil(object) {
return true
@@ -396,74 +413,38 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...)
}
-var numericZeros = []interface{}{
- int(0),
- int8(0),
- int16(0),
- int32(0),
- int64(0),
- uint(0),
- uint8(0),
- uint16(0),
- uint32(0),
- uint64(0),
- float32(0),
- float64(0),
-}
-
// isEmpty gets whether the specified object is considered empty or not.
func isEmpty(object interface{}) bool {
+ // get nil case out of the way
if object == nil {
return true
- } else if object == "" {
- return true
- } else if object == false {
- return true
- }
-
- for _, v := range numericZeros {
- if object == v {
- return true
- }
}
objValue := reflect.ValueOf(object)
switch objValue.Kind() {
- case reflect.Map:
- fallthrough
- case reflect.Slice, reflect.Chan:
- {
- return (objValue.Len() == 0)
- }
- case reflect.Struct:
- switch object.(type) {
- case time.Time:
- return object.(time.Time).IsZero()
- }
+ // collection types are empty when they have no element
+ case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
+ return objValue.Len() == 0
+ // pointers are empty if nil or if the value they point to is empty
case reflect.Ptr:
- {
- if objValue.IsNil() {
- return true
- }
- switch object.(type) {
- case *time.Time:
- return object.(*time.Time).IsZero()
- default:
- return false
- }
+ if objValue.IsNil() {
+ return true
}
+ deref := objValue.Elem().Interface()
+ return isEmpty(deref)
+ // for all other types, compare against the zero value
+ default:
+ zero := reflect.Zero(objValue.Type())
+ return reflect.DeepEqual(object, zero.Interface())
}
- return false
}
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// assert.Empty(t, obj)
-//
-// Returns whether the assertion was successful (true) or not (false).
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
pass := isEmpty(object)
@@ -481,8 +462,6 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
// if assert.NotEmpty(t, obj) {
// assert.Equal(t, "two", obj[1])
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
pass := !isEmpty(object)
@@ -509,9 +488,7 @@ func getLen(x interface{}) (ok bool, length int) {
// Len asserts that the specified object has specific length.
// Len also fails if the object has a type that len() not accept.
//
-// assert.Len(t, mySlice, 3, "The size of slice is not 3")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Len(t, mySlice, 3)
func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {
ok, l := getLen(object)
if !ok {
@@ -526,9 +503,7 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{})
// True asserts that the specified value is true.
//
-// assert.True(t, myBool, "myBool should be true")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.True(t, myBool)
func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
if value != true {
@@ -541,9 +516,7 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
// False asserts that the specified value is false.
//
-// assert.False(t, myBool, "myBool should be false")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.False(t, myBool)
func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
if value != false {
@@ -556,13 +529,15 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
// NotEqual asserts that the specified values are NOT equal.
//
-// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotEqual(t, obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
+ if err := validateEqualArgs(expected, actual); err != nil {
+ return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)",
+ expected, actual, err), msgAndArgs...)
+ }
if ObjectsAreEqual(expected, actual) {
return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...)
@@ -613,11 +588,9 @@ func includeElement(list interface{}, element interface{}) (ok, found bool) {
// Contains asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'")
-// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'")
-// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Contains(t, "Hello World", "World")
+// assert.Contains(t, ["Hello", "World"], "World")
+// assert.Contains(t, {"Hello": "World"}, "Hello")
func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
ok, found := includeElement(s, contains)
@@ -635,11 +608,9 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'")
-// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'")
-// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotContains(t, "Hello World", "Earth")
+// assert.NotContains(t, ["Hello", "World"], "Earth")
+// assert.NotContains(t, {"Hello": "World"}, "Earth")
func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
ok, found := includeElement(s, contains)
@@ -654,6 +625,142 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
}
+// Subset asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
+ if subset == nil {
+ return true // we consider nil to be equal to the nil set
+ }
+
+ subsetValue := reflect.ValueOf(subset)
+ defer func() {
+ if e := recover(); e != nil {
+ ok = false
+ }
+ }()
+
+ listKind := reflect.TypeOf(list).Kind()
+ subsetKind := reflect.TypeOf(subset).Kind()
+
+ if listKind != reflect.Array && listKind != reflect.Slice {
+ return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
+ }
+
+ if subsetKind != reflect.Array && subsetKind != reflect.Slice {
+ return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
+ }
+
+ for i := 0; i < subsetValue.Len(); i++ {
+ element := subsetValue.Index(i).Interface()
+ ok, found := includeElement(list, element)
+ if !ok {
+ return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
+ }
+ if !found {
+ return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", list, element), msgAndArgs...)
+ }
+ }
+
+ return true
+}
+
+// NotSubset asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
+ if subset == nil {
+ return Fail(t, fmt.Sprintf("nil is the empty set which is a subset of every set"), msgAndArgs...)
+ }
+
+ subsetValue := reflect.ValueOf(subset)
+ defer func() {
+ if e := recover(); e != nil {
+ ok = false
+ }
+ }()
+
+ listKind := reflect.TypeOf(list).Kind()
+ subsetKind := reflect.TypeOf(subset).Kind()
+
+ if listKind != reflect.Array && listKind != reflect.Slice {
+ return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
+ }
+
+ if subsetKind != reflect.Array && subsetKind != reflect.Slice {
+ return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
+ }
+
+ for i := 0; i < subsetValue.Len(); i++ {
+ element := subsetValue.Index(i).Interface()
+ ok, found := includeElement(list, element)
+ if !ok {
+ return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
+ }
+ if !found {
+ return true
+ }
+ }
+
+ return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
+}
+
+// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]))
+func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {
+ if isEmpty(listA) && isEmpty(listB) {
+ return true
+ }
+
+ aKind := reflect.TypeOf(listA).Kind()
+ bKind := reflect.TypeOf(listB).Kind()
+
+ if aKind != reflect.Array && aKind != reflect.Slice {
+ return Fail(t, fmt.Sprintf("%q has an unsupported type %s", listA, aKind), msgAndArgs...)
+ }
+
+ if bKind != reflect.Array && bKind != reflect.Slice {
+ return Fail(t, fmt.Sprintf("%q has an unsupported type %s", listB, bKind), msgAndArgs...)
+ }
+
+ aValue := reflect.ValueOf(listA)
+ bValue := reflect.ValueOf(listB)
+
+ aLen := aValue.Len()
+ bLen := bValue.Len()
+
+ if aLen != bLen {
+ return Fail(t, fmt.Sprintf("lengths don't match: %d != %d", aLen, bLen), msgAndArgs...)
+ }
+
+ // Mark indexes in bValue that we already used
+ visited := make([]bool, bLen)
+ for i := 0; i < aLen; i++ {
+ element := aValue.Index(i).Interface()
+ found := false
+ for j := 0; j < bLen; j++ {
+ if visited[j] {
+ continue
+ }
+ if ObjectsAreEqual(bValue.Index(j).Interface(), element) {
+ visited[j] = true
+ found = true
+ break
+ }
+ }
+ if !found {
+ return Fail(t, fmt.Sprintf("element %s appears more times in %s than in %s", element, aValue, bValue), msgAndArgs...)
+ }
+ }
+
+ return true
+}
+
// Condition uses a Comparison to assert a complex condition.
func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {
result := comp()
@@ -691,11 +798,7 @@ func didPanic(f PanicTestFunc) (bool, interface{}) {
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
-// assert.Panics(t, func(){
-// GoCrazy()
-// }, "Calling GoCrazy() should panic")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Panics(t, func(){ GoCrazy() })
func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if funcDidPanic, panicValue := didPanic(f); !funcDidPanic {
@@ -705,13 +808,26 @@ func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
return true
}
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
+// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
//
-// assert.NotPanics(t, func(){
-// RemainCalm()
-// }, "Calling RemainCalm() should NOT panic")
+// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
+func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
+
+ funcDidPanic, panicValue := didPanic(f)
+ if !funcDidPanic {
+ return Fail(t, fmt.Sprintf("func %#v should panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...)
+ }
+ if panicValue != expected {
+ return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%v\n\r\tPanic value:\t%v", f, expected, panicValue), msgAndArgs...)
+ }
+
+ return true
+}
+
+// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotPanics(t, func(){ RemainCalm() })
func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
if funcDidPanic, panicValue := didPanic(f); funcDidPanic {
@@ -723,9 +839,7 @@ func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// WithinDuration asserts that the two times are within duration delta of each other.
//
-// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
dt := expected.Sub(actual)
@@ -763,6 +877,8 @@ func toFloat(x interface{}) (float64, bool) {
xf = float64(xn)
case float64:
xf = float64(xn)
+ case time.Duration:
+ xf = float64(xn)
default:
xok = false
}
@@ -773,8 +889,6 @@ func toFloat(x interface{}) (float64, bool) {
// InDelta asserts that the two numerals are within delta of each other.
//
// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
-//
-// Returns whether the assertion was successful (true) or not (false).
func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
af, aok := toFloat(expected)
@@ -785,7 +899,7 @@ func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs
}
if math.IsNaN(af) {
- return Fail(t, fmt.Sprintf("Actual must not be NaN"), msgAndArgs...)
+ return Fail(t, fmt.Sprintf("Expected must not be NaN"), msgAndArgs...)
}
if math.IsNaN(bf) {
@@ -812,7 +926,7 @@ func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAn
expectedSlice := reflect.ValueOf(expected)
for i := 0; i < actualSlice.Len(); i++ {
- result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta)
+ result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...)
if !result {
return result
}
@@ -821,6 +935,47 @@ func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAn
return true
}
+// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
+ if expected == nil || actual == nil ||
+ reflect.TypeOf(actual).Kind() != reflect.Map ||
+ reflect.TypeOf(expected).Kind() != reflect.Map {
+ return Fail(t, "Arguments must be maps", msgAndArgs...)
+ }
+
+ expectedMap := reflect.ValueOf(expected)
+ actualMap := reflect.ValueOf(actual)
+
+ if expectedMap.Len() != actualMap.Len() {
+ return Fail(t, "Arguments must have the same numbe of keys", msgAndArgs...)
+ }
+
+ for _, k := range expectedMap.MapKeys() {
+ ev := expectedMap.MapIndex(k)
+ av := actualMap.MapIndex(k)
+
+ if !ev.IsValid() {
+ return Fail(t, fmt.Sprintf("missing key %q in expected map", k), msgAndArgs...)
+ }
+
+ if !av.IsValid() {
+ return Fail(t, fmt.Sprintf("missing key %q in actual map", k), msgAndArgs...)
+ }
+
+ if !InDelta(
+ t,
+ ev.Interface(),
+ av.Interface(),
+ delta,
+ msgAndArgs...,
+ ) {
+ return false
+ }
+ }
+
+ return true
+}
+
func calcRelativeError(expected, actual interface{}) (float64, error) {
af, aok := toFloat(expected)
if !aok {
@@ -831,15 +986,13 @@ func calcRelativeError(expected, actual interface{}) (float64, error) {
}
bf, bok := toFloat(actual)
if !bok {
- return 0, fmt.Errorf("expected value %q cannot be converted to float", actual)
+ return 0, fmt.Errorf("actual value %q cannot be converted to float", actual)
}
return math.Abs(af-bf) / math.Abs(af), nil
}
// InEpsilon asserts that expected and actual have a relative error less than epsilon
-//
-// Returns whether the assertion was successful (true) or not (false).
func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
actualEpsilon, err := calcRelativeError(expected, actual)
if err != nil {
@@ -847,7 +1000,7 @@ func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAnd
}
if actualEpsilon > epsilon {
return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+
- " < %#v (actual)", actualEpsilon, epsilon), msgAndArgs...)
+ " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...)
}
return true
@@ -882,10 +1035,8 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m
//
// actualObj, err := SomeFunction()
// if assert.NoError(t, err) {
-// assert.Equal(t, actualObj, expectedObj)
+// assert.Equal(t, expectedObj, actualObj)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
if err != nil {
return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...)
@@ -897,11 +1048,9 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
// Error asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
-// if assert.Error(t, err, "An error was expected") {
-// assert.Equal(t, err, expectedError)
+// if assert.Error(t, err) {
+// assert.Equal(t, expectedError, err)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
if err == nil {
@@ -915,9 +1064,7 @@ func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
// and that it is equal to the provided error.
//
// actualObj, err := SomeFunction()
-// assert.EqualError(t, err, expectedErrorString, "An error was expected")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.EqualError(t, err, expectedErrorString)
func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {
if !Error(t, theError, msgAndArgs...) {
return false
@@ -928,7 +1075,7 @@ func EqualError(t TestingT, theError error, errString string, msgAndArgs ...inte
if expected != actual {
return Fail(t, fmt.Sprintf("Error message not equal:\n"+
"expected: %q\n"+
- "received: %q", expected, actual), msgAndArgs...)
+ "actual : %q", expected, actual), msgAndArgs...)
}
return true
}
@@ -951,8 +1098,6 @@ func matchRegexp(rx interface{}, str interface{}) bool {
//
// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
// assert.Regexp(t, "start...$", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
match := matchRegexp(rx, str)
@@ -968,8 +1113,6 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface
//
// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
// assert.NotRegexp(t, "^start", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
match := matchRegexp(rx, str)
@@ -981,7 +1124,7 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf
}
-// Zero asserts that i is the zero value for its type and returns the truth.
+// Zero asserts that i is the zero value for its type.
func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...)
@@ -989,7 +1132,7 @@ func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
return true
}
-// NotZero asserts that i is not the zero value for its type and returns the truth.
+// NotZero asserts that i is not the zero value for its type.
func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...)
@@ -997,11 +1140,39 @@ func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
return true
}
+// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
+ info, err := os.Lstat(path)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...)
+ }
+ return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...)
+ }
+ if info.IsDir() {
+ return Fail(t, fmt.Sprintf("%q is a directory", path), msgAndArgs...)
+ }
+ return true
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
+ info, err := os.Lstat(path)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...)
+ }
+ return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...)
+ }
+ if !info.IsDir() {
+ return Fail(t, fmt.Sprintf("%q is a file", path), msgAndArgs...)
+ }
+ return true
+}
+
// JSONEq asserts that two JSON strings are equivalent.
//
// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-//
-// Returns whether the assertion was successful (true) or not (false).
func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {
var expectedJSONAsInterface, actualJSONAsInterface interface{}
@@ -1061,6 +1232,22 @@ func diff(expected interface{}, actual interface{}) string {
return "\n\nDiff:\n" + diff
}
+// validateEqualArgs checks whether provided arguments can be safely used in the
+// Equal/NotEqual functions.
+func validateEqualArgs(expected, actual interface{}) error {
+ if isFunction(expected) || isFunction(actual) {
+ return errors.New("cannot take func type as argument")
+ }
+ return nil
+}
+
+func isFunction(arg interface{}) bool {
+ if arg == nil {
+ return false
+ }
+ return reflect.TypeOf(arg).Kind() == reflect.Func
+}
+
var spewConfig = spew.ConfigState{
Indent: " ",
DisablePointerAddresses: true,
diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go
index b867e95ea..9ad56851d 100644
--- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go
+++ b/vendor/github.com/stretchr/testify/assert/forward_assertions.go
@@ -13,4 +13,4 @@ func New(t TestingT) *Assertions {
}
}
-//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl
+//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs
diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go
index fa7ab89b1..3101e78dd 100644
--- a/vendor/github.com/stretchr/testify/assert/http_assertions.go
+++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go
@@ -8,16 +8,16 @@ import (
"strings"
)
-// httpCode is a helper that returns HTTP code of the response. It returns -1
-// if building a new request fails.
-func httpCode(handler http.HandlerFunc, method, url string, values url.Values) int {
+// httpCode is a helper that returns HTTP code of the response. It returns -1 and
+// an error if building a new request fails.
+func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) {
w := httptest.NewRecorder()
req, err := http.NewRequest(method, url+"?"+values.Encode(), nil)
if err != nil {
- return -1
+ return -1, err
}
handler(w, req)
- return w.Code
+ return w.Code, nil
}
// HTTPSuccess asserts that a specified handler returns a success status code.
@@ -25,12 +25,19 @@ func httpCode(handler http.HandlerFunc, method, url string, values url.Values) i
// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool {
- code := httpCode(handler, method, url, values)
- if code == -1 {
+func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
+ code, err := httpCode(handler, method, url, values)
+ if err != nil {
+ Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
return false
}
- return code >= http.StatusOK && code <= http.StatusPartialContent
+
+ isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent
+ if !isSuccessCode {
+ Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code))
+ }
+
+ return isSuccessCode
}
// HTTPRedirect asserts that a specified handler returns a redirect status code.
@@ -38,12 +45,19 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value
// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool {
- code := httpCode(handler, method, url, values)
- if code == -1 {
+func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
+ code, err := httpCode(handler, method, url, values)
+ if err != nil {
+ Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
return false
}
- return code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect
+
+ isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect
+ if !isRedirectCode {
+ Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code))
+ }
+
+ return isRedirectCode
}
// HTTPError asserts that a specified handler returns an error status code.
@@ -51,12 +65,19 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu
// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool {
- code := httpCode(handler, method, url, values)
- if code == -1 {
+func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
+ code, err := httpCode(handler, method, url, values)
+ if err != nil {
+ Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
return false
}
- return code >= http.StatusBadRequest
+
+ isErrorCode := code >= http.StatusBadRequest
+ if !isErrorCode {
+ Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code))
+ }
+
+ return isErrorCode
}
// HTTPBody is a helper that returns HTTP body of the response. It returns
@@ -77,7 +98,7 @@ func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) s
// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool {
+func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
body := HTTPBody(handler, method, url, values)
contains := strings.Contains(body, fmt.Sprint(str))
@@ -94,7 +115,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string,
// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool {
+func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
body := HTTPBody(handler, method, url, values)
contains := strings.Contains(body, fmt.Sprint(str))
diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go
index d3c2ab9bc..ac71d4058 100644
--- a/vendor/github.com/stretchr/testify/require/forward_requirements.go
+++ b/vendor/github.com/stretchr/testify/require/forward_requirements.go
@@ -13,4 +13,4 @@ func New(t TestingT) *Assertions {
}
}
-//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl
+//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl -include-format-funcs
diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go
index fc567f140..3741b7bd0 100644
--- a/vendor/github.com/stretchr/testify/require/require.go
+++ b/vendor/github.com/stretchr/testify/require/require.go
@@ -19,40 +19,100 @@ func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
}
}
+// Conditionf uses a Comparison to assert a complex condition.
+func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {
+ if !assert.Conditionf(t, comp, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Contains asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'")
-// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'")
-// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Contains(t, "Hello World", "World")
+// assert.Contains(t, ["Hello", "World"], "World")
+// assert.Contains(t, {"Hello": "World"}, "Hello")
func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
if !assert.Contains(t, s, contains, msgAndArgs...) {
t.FailNow()
}
}
+// Containsf asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
+// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
+// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
+func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
+ if !assert.Containsf(t, s, contains, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
+ if !assert.DirExists(t, path, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func DirExistsf(t TestingT, path string, msg string, args ...interface{}) {
+ if !assert.DirExistsf(t, path, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]))
+func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
+ if !assert.ElementsMatch(t, listA, listB, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted"))
+func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
+ if !assert.ElementsMatchf(t, listA, listB, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// assert.Empty(t, obj)
-//
-// Returns whether the assertion was successful (true) or not (false).
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
if !assert.Empty(t, object, msgAndArgs...) {
t.FailNow()
}
}
-// Equal asserts that two objects are equal.
+// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
//
-// assert.Equal(t, 123, 123, "123 and 123 should be equal")
+// assert.Emptyf(t, obj, "error message %s", "formatted")
+func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.Emptyf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Equal asserts that two objects are equal.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Equal(t, 123, 123)
//
// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
if !assert.Equal(t, expected, actual, msgAndArgs...) {
t.FailNow()
@@ -63,52 +123,99 @@ func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...i
// and that it is equal to the provided error.
//
// actualObj, err := SomeFunction()
-// assert.EqualError(t, err, expectedErrorString, "An error was expected")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.EqualError(t, err, expectedErrorString)
func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
if !assert.EqualError(t, theError, errString, msgAndArgs...) {
t.FailNow()
}
}
+// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
+func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
+ if !assert.EqualErrorf(t, theError, errString, msg, args...) {
+ t.FailNow()
+ }
+}
+
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
-// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.EqualValues(t, uint32(123), int32(123))
func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
if !assert.EqualValues(t, expected, actual, msgAndArgs...) {
t.FailNow()
}
}
+// EqualValuesf asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
+func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.EqualValuesf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Equalf asserts that two objects are equal.
+//
+// assert.Equalf(t, 123, 123, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.Equalf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Error asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
-// if assert.Error(t, err, "An error was expected") {
-// assert.Equal(t, err, expectedError)
+// if assert.Error(t, err) {
+// assert.Equal(t, expectedError, err)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func Error(t TestingT, err error, msgAndArgs ...interface{}) {
if !assert.Error(t, err, msgAndArgs...) {
t.FailNow()
}
}
-// Exactly asserts that two objects are equal is value and type.
+// Errorf asserts that a function returned an error (i.e. not `nil`).
//
-// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal")
+// actualObj, err := SomeFunction()
+// if assert.Errorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
+func Errorf(t TestingT, err error, msg string, args ...interface{}) {
+ if !assert.Errorf(t, err, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Exactly asserts that two objects are equal in value and type.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Exactly(t, int32(123), int64(123))
func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
if !assert.Exactly(t, expected, actual, msgAndArgs...) {
t.FailNow()
}
}
+// Exactlyf asserts that two objects are equal in value and type.
+//
+// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
+func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.Exactlyf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Fail reports a failure through
func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
if !assert.Fail(t, failureMessage, msgAndArgs...) {
@@ -123,25 +230,72 @@ func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
}
}
+// FailNowf fails test
+func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {
+ if !assert.FailNowf(t, failureMessage, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Failf reports a failure through
+func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {
+ if !assert.Failf(t, failureMessage, msg, args...) {
+ t.FailNow()
+ }
+}
+
// False asserts that the specified value is false.
//
-// assert.False(t, myBool, "myBool should be false")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.False(t, myBool)
func False(t TestingT, value bool, msgAndArgs ...interface{}) {
if !assert.False(t, value, msgAndArgs...) {
t.FailNow()
}
}
+// Falsef asserts that the specified value is false.
+//
+// assert.Falsef(t, myBool, "error message %s", "formatted")
+func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
+ if !assert.Falsef(t, value, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
+ if !assert.FileExists(t, path, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func FileExistsf(t TestingT, path string, msg string, args ...interface{}) {
+ if !assert.FileExistsf(t, path, msg, args...) {
+ t.FailNow()
+ }
+}
+
// HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
- if !assert.HTTPBodyContains(t, handler, method, url, values, str) {
+func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ if !assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPBodyContainsf asserts that a specified handler returns a
+// body that contains a string.
+//
+// assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ if !assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {
t.FailNow()
}
}
@@ -152,8 +306,20 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url s
// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
- if !assert.HTTPBodyNotContains(t, handler, method, url, values, str) {
+func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ if !assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPBodyNotContainsf asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ if !assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {
t.FailNow()
}
}
@@ -163,8 +329,19 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, ur
// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
- if !assert.HTTPError(t, handler, method, url, values) {
+func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ if !assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPErrorf asserts that a specified handler returns an error status code.
+//
+// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ if !assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {
t.FailNow()
}
}
@@ -174,8 +351,19 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string,
// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
- if !assert.HTTPRedirect(t, handler, method, url, values) {
+func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ if !assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPRedirectf asserts that a specified handler returns a redirect status code.
+//
+// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ if !assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {
t.FailNow()
}
}
@@ -185,32 +373,64 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url strin
// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
- if !assert.HTTPSuccess(t, handler, method, url, values) {
+func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ if !assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPSuccessf asserts that a specified handler returns a success status code.
+//
+// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ if !assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {
t.FailNow()
}
}
// Implements asserts that an object is implemented by the specified interface.
//
-// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject")
+// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
if !assert.Implements(t, interfaceObject, object, msgAndArgs...) {
t.FailNow()
}
}
+// Implementsf asserts that an object is implemented by the specified interface.
+//
+// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
+func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
+ if !assert.Implementsf(t, interfaceObject, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
// InDelta asserts that the two numerals are within delta of each other.
//
// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
-//
-// Returns whether the assertion was successful (true) or not (false).
func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
t.FailNow()
}
}
+// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ if !assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ if !assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
// InDeltaSlice is the same as InDelta, except it compares two slices.
func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
@@ -218,9 +438,23 @@ func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta fl
}
}
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
+// InDeltaSlicef is the same as InDelta, except it compares two slices.
+func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ if !assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaf asserts that the two numerals are within delta of each other.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
+func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ if !assert.InDeltaf(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InEpsilon asserts that expected and actual have a relative error less than epsilon
func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
t.FailNow()
@@ -234,6 +468,20 @@ func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilo
}
}
+// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
+func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ if !assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InEpsilonf asserts that expected and actual have a relative error less than epsilon
+func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ if !assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {
+ t.FailNow()
+ }
+}
+
// IsType asserts that the specified objects are of the same type.
func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
if !assert.IsType(t, expectedType, object, msgAndArgs...) {
@@ -241,87 +489,144 @@ func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs
}
}
+// IsTypef asserts that the specified objects are of the same type.
+func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {
+ if !assert.IsTypef(t, expectedType, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
// JSONEq asserts that two JSON strings are equivalent.
//
// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-//
-// Returns whether the assertion was successful (true) or not (false).
func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
if !assert.JSONEq(t, expected, actual, msgAndArgs...) {
t.FailNow()
}
}
+// JSONEqf asserts that two JSON strings are equivalent.
+//
+// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
+ if !assert.JSONEqf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Len asserts that the specified object has specific length.
// Len also fails if the object has a type that len() not accept.
//
-// assert.Len(t, mySlice, 3, "The size of slice is not 3")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Len(t, mySlice, 3)
func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
if !assert.Len(t, object, length, msgAndArgs...) {
t.FailNow()
}
}
-// Nil asserts that the specified object is nil.
+// Lenf asserts that the specified object has specific length.
+// Lenf also fails if the object has a type that len() not accept.
//
-// assert.Nil(t, err, "err should be nothing")
+// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
+func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {
+ if !assert.Lenf(t, object, length, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Nil asserts that the specified object is nil.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Nil(t, err)
func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
if !assert.Nil(t, object, msgAndArgs...) {
t.FailNow()
}
}
+// Nilf asserts that the specified object is nil.
+//
+// assert.Nilf(t, err, "error message %s", "formatted")
+func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.Nilf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
// NoError asserts that a function returned no error (i.e. `nil`).
//
// actualObj, err := SomeFunction()
// if assert.NoError(t, err) {
-// assert.Equal(t, actualObj, expectedObj)
+// assert.Equal(t, expectedObj, actualObj)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
if !assert.NoError(t, err, msgAndArgs...) {
t.FailNow()
}
}
+// NoErrorf asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.NoErrorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
+ if !assert.NoErrorf(t, err, msg, args...) {
+ t.FailNow()
+ }
+}
+
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'")
-// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'")
-// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotContains(t, "Hello World", "Earth")
+// assert.NotContains(t, ["Hello", "World"], "Earth")
+// assert.NotContains(t, {"Hello": "World"}, "Earth")
func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
if !assert.NotContains(t, s, contains, msgAndArgs...) {
t.FailNow()
}
}
+// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
+func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
+ if !assert.NotContainsf(t, s, contains, msg, args...) {
+ t.FailNow()
+ }
+}
+
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// if assert.NotEmpty(t, obj) {
// assert.Equal(t, "two", obj[1])
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
if !assert.NotEmpty(t, object, msgAndArgs...) {
t.FailNow()
}
}
-// NotEqual asserts that the specified values are NOT equal.
+// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
//
-// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal")
+// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
+func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.NotEmptyf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotEqual asserts that the specified values are NOT equal.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotEqual(t, obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -331,99 +636,232 @@ func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs .
}
}
-// NotNil asserts that the specified object is not nil.
+// NotEqualf asserts that the specified values are NOT equal.
//
-// assert.NotNil(t, err, "err should be something")
+// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
//
-// Returns whether the assertion was successful (true) or not (false).
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.NotEqualf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotNil asserts that the specified object is not nil.
+//
+// assert.NotNil(t, err)
func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
if !assert.NotNil(t, object, msgAndArgs...) {
t.FailNow()
}
}
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
+// NotNilf asserts that the specified object is not nil.
//
-// assert.NotPanics(t, func(){
-// RemainCalm()
-// }, "Calling RemainCalm() should NOT panic")
+// assert.NotNilf(t, err, "error message %s", "formatted")
+func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.NotNilf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.NotPanics(t, func(){ RemainCalm() })
func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
if !assert.NotPanics(t, f, msgAndArgs...) {
t.FailNow()
}
}
+// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
+func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ if !assert.NotPanicsf(t, f, msg, args...) {
+ t.FailNow()
+ }
+}
+
// NotRegexp asserts that a specified regexp does not match a string.
//
// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
// assert.NotRegexp(t, "^start", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
if !assert.NotRegexp(t, rx, str, msgAndArgs...) {
t.FailNow()
}
}
-// NotZero asserts that i is not the zero value for its type and returns the truth.
+// NotRegexpf asserts that a specified regexp does not match a string.
+//
+// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
+// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
+func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
+ if !assert.NotRegexpf(t, rx, str, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotSubset asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotSubset(t, list, subset, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotSubsetf asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
+ if !assert.NotSubsetf(t, list, subset, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotZero asserts that i is not the zero value for its type.
func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
if !assert.NotZero(t, i, msgAndArgs...) {
t.FailNow()
}
}
+// NotZerof asserts that i is not the zero value for its type.
+func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {
+ if !assert.NotZerof(t, i, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
-// assert.Panics(t, func(){
-// GoCrazy()
-// }, "Calling GoCrazy() should panic")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Panics(t, func(){ GoCrazy() })
func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
if !assert.Panics(t, f, msgAndArgs...) {
t.FailNow()
}
}
+// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
+func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ if !assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ if !assert.PanicsWithValuef(t, expected, f, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Panicsf asserts that the code inside the specified PanicTestFunc panics.
+//
+// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
+func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ if !assert.Panicsf(t, f, msg, args...) {
+ t.FailNow()
+ }
+}
+
// Regexp asserts that a specified regexp matches a string.
//
// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
// assert.Regexp(t, "start...$", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
if !assert.Regexp(t, rx, str, msgAndArgs...) {
t.FailNow()
}
}
-// True asserts that the specified value is true.
+// Regexpf asserts that a specified regexp matches a string.
+//
+// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
+// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
+func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
+ if !assert.Regexpf(t, rx, str, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Subset asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
//
-// assert.True(t, myBool, "myBool should be true")
+// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ if !assert.Subset(t, list, subset, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Subsetf asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
+ if !assert.Subsetf(t, list, subset, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// True asserts that the specified value is true.
+//
+// assert.True(t, myBool)
func True(t TestingT, value bool, msgAndArgs ...interface{}) {
if !assert.True(t, value, msgAndArgs...) {
t.FailNow()
}
}
-// WithinDuration asserts that the two times are within duration delta of each other.
+// Truef asserts that the specified value is true.
//
-// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s")
+// assert.Truef(t, myBool, "error message %s", "formatted")
+func Truef(t TestingT, value bool, msg string, args ...interface{}) {
+ if !assert.Truef(t, value, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// WithinDuration asserts that the two times are within duration delta of each other.
//
-// Returns whether the assertion was successful (true) or not (false).
+// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
t.FailNow()
}
}
-// Zero asserts that i is the zero value for its type and returns the truth.
+// WithinDurationf asserts that the two times are within duration delta of each other.
+//
+// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
+ if !assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Zero asserts that i is the zero value for its type.
func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
if !assert.Zero(t, i, msgAndArgs...) {
t.FailNow()
}
}
+
+// Zerof asserts that i is the zero value for its type.
+func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {
+ if !assert.Zerof(t, i, msg, args...) {
+ t.FailNow()
+ }
+}
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go
index caa18793d..a26b16f9d 100644
--- a/vendor/github.com/stretchr/testify/require/require_forward.go
+++ b/vendor/github.com/stretchr/testify/require/require_forward.go
@@ -17,36 +17,82 @@ func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}
Condition(a.t, comp, msgAndArgs...)
}
+// Conditionf uses a Comparison to assert a complex condition.
+func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {
+ Conditionf(a.t, comp, msg, args...)
+}
+
// Contains asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
-// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'")
-// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'")
-// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Contains("Hello World", "World")
+// a.Contains(["Hello", "World"], "World")
+// a.Contains({"Hello": "World"}, "Hello")
func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
Contains(a.t, s, contains, msgAndArgs...)
}
+// Containsf asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// a.Containsf("Hello World", "World", "error message %s", "formatted")
+// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
+// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
+func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
+ Containsf(a.t, s, contains, msg, args...)
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {
+ DirExists(a.t, path, msgAndArgs...)
+}
+
+// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {
+ DirExistsf(a.t, path, msg, args...)
+}
+
+// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]))
+func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
+ ElementsMatch(a.t, listA, listB, msgAndArgs...)
+}
+
+// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted"))
+func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {
+ ElementsMatchf(a.t, listA, listB, msg, args...)
+}
+
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// a.Empty(obj)
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {
Empty(a.t, object, msgAndArgs...)
}
-// Equal asserts that two objects are equal.
+// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
//
-// a.Equal(123, 123, "123 and 123 should be equal")
+// a.Emptyf(obj, "error message %s", "formatted")
+func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {
+ Emptyf(a.t, object, msg, args...)
+}
+
+// Equal asserts that two objects are equal.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Equal(123, 123)
//
// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
Equal(a.t, expected, actual, msgAndArgs...)
}
@@ -55,44 +101,81 @@ func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs
// and that it is equal to the provided error.
//
// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString, "An error was expected")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.EqualError(err, expectedErrorString)
func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {
EqualError(a.t, theError, errString, msgAndArgs...)
}
+// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
+func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {
+ EqualErrorf(a.t, theError, errString, msg, args...)
+}
+
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
-// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.EqualValues(uint32(123), int32(123))
func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
EqualValues(a.t, expected, actual, msgAndArgs...)
}
+// EqualValuesf asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
+func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ EqualValuesf(a.t, expected, actual, msg, args...)
+}
+
+// Equalf asserts that two objects are equal.
+//
+// a.Equalf(123, 123, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ Equalf(a.t, expected, actual, msg, args...)
+}
+
// Error asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
-// if a.Error(err, "An error was expected") {
-// assert.Equal(t, err, expectedError)
+// if a.Error(err) {
+// assert.Equal(t, expectedError, err)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
Error(a.t, err, msgAndArgs...)
}
-// Exactly asserts that two objects are equal is value and type.
+// Errorf asserts that a function returned an error (i.e. not `nil`).
//
-// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal")
+// actualObj, err := SomeFunction()
+// if a.Errorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
+func (a *Assertions) Errorf(err error, msg string, args ...interface{}) {
+ Errorf(a.t, err, msg, args...)
+}
+
+// Exactly asserts that two objects are equal in value and type.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Exactly(int32(123), int64(123))
func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
Exactly(a.t, expected, actual, msgAndArgs...)
}
+// Exactlyf asserts that two objects are equal in value and type.
+//
+// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
+func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ Exactlyf(a.t, expected, actual, msg, args...)
+}
+
// Fail reports a failure through
func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
Fail(a.t, failureMessage, msgAndArgs...)
@@ -103,23 +186,58 @@ func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
FailNow(a.t, failureMessage, msgAndArgs...)
}
+// FailNowf fails test
+func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {
+ FailNowf(a.t, failureMessage, msg, args...)
+}
+
+// Failf reports a failure through
+func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {
+ Failf(a.t, failureMessage, msg, args...)
+}
+
// False asserts that the specified value is false.
//
-// a.False(myBool, "myBool should be false")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.False(myBool)
func (a *Assertions) False(value bool, msgAndArgs ...interface{}) {
False(a.t, value, msgAndArgs...)
}
+// Falsef asserts that the specified value is false.
+//
+// a.Falsef(myBool, "error message %s", "formatted")
+func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {
+ Falsef(a.t, value, msg, args...)
+}
+
+// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {
+ FileExists(a.t, path, msgAndArgs...)
+}
+
+// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {
+ FileExistsf(a.t, path, msg, args...)
+}
+
// HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
//
// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
- HTTPBodyContains(a.t, handler, method, url, values, str)
+func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
+}
+
+// HTTPBodyContainsf asserts that a specified handler returns a
+// body that contains a string.
+//
+// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
}
// HTTPBodyNotContains asserts that a specified handler returns a
@@ -128,8 +246,18 @@ func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, u
// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
- HTTPBodyNotContains(a.t, handler, method, url, values, str)
+func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
+}
+
+// HTTPBodyNotContainsf asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
}
// HTTPError asserts that a specified handler returns an error status code.
@@ -137,8 +265,17 @@ func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string
// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) {
- HTTPError(a.t, handler, method, url, values)
+func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ HTTPError(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPErrorf asserts that a specified handler returns an error status code.
+//
+// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ HTTPErrorf(a.t, handler, method, url, values, msg, args...)
}
// HTTPRedirect asserts that a specified handler returns a redirect status code.
@@ -146,8 +283,17 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri
// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) {
- HTTPRedirect(a.t, handler, method, url, values)
+func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPRedirectf asserts that a specified handler returns a redirect status code.
+//
+// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
}
// HTTPSuccess asserts that a specified handler returns a success status code.
@@ -155,34 +301,68 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
//
// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) {
- HTTPSuccess(a.t, handler, method, url, values)
+func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPSuccessf asserts that a specified handler returns a success status code.
+//
+// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
}
// Implements asserts that an object is implemented by the specified interface.
//
-// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject")
+// a.Implements((*MyInterface)(nil), new(MyObject))
func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
Implements(a.t, interfaceObject, object, msgAndArgs...)
}
+// Implementsf asserts that an object is implemented by the specified interface.
+//
+// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
+func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
+ Implementsf(a.t, interfaceObject, object, msg, args...)
+}
+
// InDelta asserts that the two numerals are within delta of each other.
//
// a.InDelta(math.Pi, (22 / 7.0), 0.01)
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
InDelta(a.t, expected, actual, delta, msgAndArgs...)
}
+// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
+}
+
+// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
+}
+
// InDeltaSlice is the same as InDelta, except it compares two slices.
func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
}
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
+// InDeltaSlicef is the same as InDelta, except it compares two slices.
+func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
+}
+
+// InDeltaf asserts that the two numerals are within delta of each other.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
+func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ InDeltaf(a.t, expected, actual, delta, msg, args...)
+}
+
+// InEpsilon asserts that expected and actual have a relative error less than epsilon
func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
}
@@ -192,80 +372,133 @@ func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, ep
InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
}
+// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
+func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
+}
+
+// InEpsilonf asserts that expected and actual have a relative error less than epsilon
+func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
+}
+
// IsType asserts that the specified objects are of the same type.
func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
IsType(a.t, expectedType, object, msgAndArgs...)
}
+// IsTypef asserts that the specified objects are of the same type.
+func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {
+ IsTypef(a.t, expectedType, object, msg, args...)
+}
+
// JSONEq asserts that two JSON strings are equivalent.
//
// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {
JSONEq(a.t, expected, actual, msgAndArgs...)
}
+// JSONEqf asserts that two JSON strings are equivalent.
+//
+// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {
+ JSONEqf(a.t, expected, actual, msg, args...)
+}
+
// Len asserts that the specified object has specific length.
// Len also fails if the object has a type that len() not accept.
//
-// a.Len(mySlice, 3, "The size of slice is not 3")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Len(mySlice, 3)
func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {
Len(a.t, object, length, msgAndArgs...)
}
-// Nil asserts that the specified object is nil.
+// Lenf asserts that the specified object has specific length.
+// Lenf also fails if the object has a type that len() not accept.
//
-// a.Nil(err, "err should be nothing")
+// a.Lenf(mySlice, 3, "error message %s", "formatted")
+func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {
+ Lenf(a.t, object, length, msg, args...)
+}
+
+// Nil asserts that the specified object is nil.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Nil(err)
func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {
Nil(a.t, object, msgAndArgs...)
}
+// Nilf asserts that the specified object is nil.
+//
+// a.Nilf(err, "error message %s", "formatted")
+func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {
+ Nilf(a.t, object, msg, args...)
+}
+
// NoError asserts that a function returned no error (i.e. `nil`).
//
// actualObj, err := SomeFunction()
// if a.NoError(err) {
-// assert.Equal(t, actualObj, expectedObj)
+// assert.Equal(t, expectedObj, actualObj)
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {
NoError(a.t, err, msgAndArgs...)
}
+// NoErrorf asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if a.NoErrorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {
+ NoErrorf(a.t, err, msg, args...)
+}
+
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
-// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'")
-// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'")
-// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.NotContains("Hello World", "Earth")
+// a.NotContains(["Hello", "World"], "Earth")
+// a.NotContains({"Hello": "World"}, "Earth")
func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
NotContains(a.t, s, contains, msgAndArgs...)
}
+// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
+// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
+// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
+func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
+ NotContainsf(a.t, s, contains, msg, args...)
+}
+
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// if a.NotEmpty(obj) {
// assert.Equal(t, "two", obj[1])
// }
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {
NotEmpty(a.t, object, msgAndArgs...)
}
-// NotEqual asserts that the specified values are NOT equal.
+// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
//
-// a.NotEqual(obj1, obj2, "two objects shouldn't be equal")
+// if a.NotEmptyf(obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
+func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {
+ NotEmptyf(a.t, object, msg, args...)
+}
+
+// NotEqual asserts that the specified values are NOT equal.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.NotEqual(obj1, obj2)
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
@@ -273,81 +506,182 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr
NotEqual(a.t, expected, actual, msgAndArgs...)
}
-// NotNil asserts that the specified object is not nil.
+// NotEqualf asserts that the specified values are NOT equal.
//
-// a.NotNil(err, "err should be something")
+// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
//
-// Returns whether the assertion was successful (true) or not (false).
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ NotEqualf(a.t, expected, actual, msg, args...)
+}
+
+// NotNil asserts that the specified object is not nil.
+//
+// a.NotNil(err)
func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {
NotNil(a.t, object, msgAndArgs...)
}
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
+// NotNilf asserts that the specified object is not nil.
//
-// a.NotPanics(func(){
-// RemainCalm()
-// }, "Calling RemainCalm() should NOT panic")
+// a.NotNilf(err, "error message %s", "formatted")
+func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {
+ NotNilf(a.t, object, msg, args...)
+}
+
+// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.NotPanics(func(){ RemainCalm() })
func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
NotPanics(a.t, f, msgAndArgs...)
}
+// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
+func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
+ NotPanicsf(a.t, f, msg, args...)
+}
+
// NotRegexp asserts that a specified regexp does not match a string.
//
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
// a.NotRegexp("^start", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
NotRegexp(a.t, rx, str, msgAndArgs...)
}
-// NotZero asserts that i is not the zero value for its type and returns the truth.
+// NotRegexpf asserts that a specified regexp does not match a string.
+//
+// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
+// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
+func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
+ NotRegexpf(a.t, rx, str, msg, args...)
+}
+
+// NotSubset asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ NotSubset(a.t, list, subset, msgAndArgs...)
+}
+
+// NotSubsetf asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
+ NotSubsetf(a.t, list, subset, msg, args...)
+}
+
+// NotZero asserts that i is not the zero value for its type.
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {
NotZero(a.t, i, msgAndArgs...)
}
+// NotZerof asserts that i is not the zero value for its type.
+func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {
+ NotZerof(a.t, i, msg, args...)
+}
+
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
-// a.Panics(func(){
-// GoCrazy()
-// }, "Calling GoCrazy() should panic")
-//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Panics(func(){ GoCrazy() })
func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
Panics(a.t, f, msgAndArgs...)
}
+// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
+func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ PanicsWithValue(a.t, expected, f, msgAndArgs...)
+}
+
+// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ PanicsWithValuef(a.t, expected, f, msg, args...)
+}
+
+// Panicsf asserts that the code inside the specified PanicTestFunc panics.
+//
+// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
+func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
+ Panicsf(a.t, f, msg, args...)
+}
+
// Regexp asserts that a specified regexp matches a string.
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting")
-//
-// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
Regexp(a.t, rx, str, msgAndArgs...)
}
-// True asserts that the specified value is true.
+// Regexpf asserts that a specified regexp matches a string.
//
-// a.True(myBool, "myBool should be true")
+// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
+// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
+func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
+ Regexpf(a.t, rx, str, msg, args...)
+}
+
+// Subset asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ Subset(a.t, list, subset, msgAndArgs...)
+}
+
+// Subsetf asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
+ Subsetf(a.t, list, subset, msg, args...)
+}
+
+// True asserts that the specified value is true.
+//
+// a.True(myBool)
func (a *Assertions) True(value bool, msgAndArgs ...interface{}) {
True(a.t, value, msgAndArgs...)
}
-// WithinDuration asserts that the two times are within duration delta of each other.
+// Truef asserts that the specified value is true.
//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s")
+// a.Truef(myBool, "error message %s", "formatted")
+func (a *Assertions) Truef(value bool, msg string, args ...interface{}) {
+ Truef(a.t, value, msg, args...)
+}
+
+// WithinDuration asserts that the two times are within duration delta of each other.
//
-// Returns whether the assertion was successful (true) or not (false).
+// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
}
-// Zero asserts that i is the zero value for its type and returns the truth.
+// WithinDurationf asserts that the two times are within duration delta of each other.
+//
+// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
+ WithinDurationf(a.t, expected, actual, delta, msg, args...)
+}
+
+// Zero asserts that i is the zero value for its type.
func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {
Zero(a.t, i, msgAndArgs...)
}
+
+// Zerof asserts that i is the zero value for its type.
+func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {
+ Zerof(a.t, i, msg, args...)
+}
diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go
index 41147562d..e404f016d 100644
--- a/vendor/github.com/stretchr/testify/require/requirements.go
+++ b/vendor/github.com/stretchr/testify/require/requirements.go
@@ -6,4 +6,4 @@ type TestingT interface {
FailNow()
}
-//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl
+//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl -include-format-funcs
diff --git a/vendor/gitlab.com/gitlab-org/gitaly-proto/go/VERSION b/vendor/gitlab.com/gitlab-org/gitaly-proto/go/VERSION
index 31b648bd6..c52842c46 100644
--- a/vendor/gitlab.com/gitlab-org/gitaly-proto/go/VERSION
+++ b/vendor/gitlab.com/gitlab-org/gitaly-proto/go/VERSION
@@ -1 +1 @@
-0.73.0
+0.75.0
diff --git a/vendor/gitlab.com/gitlab-org/gitaly-proto/go/blob.pb.go b/vendor/gitlab.com/gitlab-org/gitaly-proto/go/blob.pb.go
index fe4692bd0..efa8bdd13 100644
--- a/vendor/gitlab.com/gitlab-org/gitaly-proto/go/blob.pb.go
+++ b/vendor/gitlab.com/gitlab-org/gitaly-proto/go/blob.pb.go
@@ -26,6 +26,9 @@ It has these top-level messages:
GetBlobResponse
GetBlobsRequest
GetBlobsResponse
+ LFSPointer
+ GetLFSPointersRequest
+ GetLFSPointersResponse
CommitStatsRequest
CommitStatsResponse
CommitIsAncestorRequest
@@ -382,11 +385,86 @@ func (m *GetBlobsResponse) GetOid() string {
return ""
}
+type LFSPointer struct {
+ Size int64 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
+ Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
+ Oid string `protobuf:"bytes,3,opt,name=oid" json:"oid,omitempty"`
+}
+
+func (m *LFSPointer) Reset() { *m = LFSPointer{} }
+func (m *LFSPointer) String() string { return proto.CompactTextString(m) }
+func (*LFSPointer) ProtoMessage() {}
+func (*LFSPointer) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+
+func (m *LFSPointer) GetSize() int64 {
+ if m != nil {
+ return m.Size
+ }
+ return 0
+}
+
+func (m *LFSPointer) GetData() []byte {
+ if m != nil {
+ return m.Data
+ }
+ return nil
+}
+
+func (m *LFSPointer) GetOid() string {
+ if m != nil {
+ return m.Oid
+ }
+ return ""
+}
+
+type GetLFSPointersRequest struct {
+ Repository *Repository `protobuf:"bytes,1,opt,name=repository" json:"repository,omitempty"`
+ BlobIds []string `protobuf:"bytes,2,rep,name=blob_ids,json=blobIds" json:"blob_ids,omitempty"`
+}
+
+func (m *GetLFSPointersRequest) Reset() { *m = GetLFSPointersRequest{} }
+func (m *GetLFSPointersRequest) String() string { return proto.CompactTextString(m) }
+func (*GetLFSPointersRequest) ProtoMessage() {}
+func (*GetLFSPointersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+
+func (m *GetLFSPointersRequest) GetRepository() *Repository {
+ if m != nil {
+ return m.Repository
+ }
+ return nil
+}
+
+func (m *GetLFSPointersRequest) GetBlobIds() []string {
+ if m != nil {
+ return m.BlobIds
+ }
+ return nil
+}
+
+type GetLFSPointersResponse struct {
+ LfsPointers []*LFSPointer `protobuf:"bytes,1,rep,name=lfs_pointers,json=lfsPointers" json:"lfs_pointers,omitempty"`
+}
+
+func (m *GetLFSPointersResponse) Reset() { *m = GetLFSPointersResponse{} }
+func (m *GetLFSPointersResponse) String() string { return proto.CompactTextString(m) }
+func (*GetLFSPointersResponse) ProtoMessage() {}
+func (*GetLFSPointersResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+
+func (m *GetLFSPointersResponse) GetLfsPointers() []*LFSPointer {
+ if m != nil {
+ return m.LfsPointers
+ }
+ return nil
+}
+
func init() {
proto.RegisterType((*GetBlobRequest)(nil), "gitaly.GetBlobRequest")
proto.RegisterType((*GetBlobResponse)(nil), "gitaly.GetBlobResponse")
proto.RegisterType((*GetBlobsRequest)(nil), "gitaly.GetBlobsRequest")
proto.RegisterType((*GetBlobsResponse)(nil), "gitaly.GetBlobsResponse")
+ proto.RegisterType((*LFSPointer)(nil), "gitaly.LFSPointer")
+ proto.RegisterType((*GetLFSPointersRequest)(nil), "gitaly.GetLFSPointersRequest")
+ proto.RegisterType((*GetLFSPointersResponse)(nil), "gitaly.GetLFSPointersResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -409,6 +487,7 @@ type BlobServiceClient interface {
// The blobs are sent in a continous stream, the caller is responsible for spliting
// them up into multiple blobs by their object IDs.
GetBlobs(ctx context.Context, in *GetBlobsRequest, opts ...grpc.CallOption) (BlobService_GetBlobsClient, error)
+ GetLFSPointers(ctx context.Context, in *GetLFSPointersRequest, opts ...grpc.CallOption) (BlobService_GetLFSPointersClient, error)
}
type blobServiceClient struct {
@@ -483,6 +562,38 @@ func (x *blobServiceGetBlobsClient) Recv() (*GetBlobsResponse, error) {
return m, nil
}
+func (c *blobServiceClient) GetLFSPointers(ctx context.Context, in *GetLFSPointersRequest, opts ...grpc.CallOption) (BlobService_GetLFSPointersClient, error) {
+ stream, err := grpc.NewClientStream(ctx, &_BlobService_serviceDesc.Streams[2], c.cc, "/gitaly.BlobService/GetLFSPointers", opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &blobServiceGetLFSPointersClient{stream}
+ if err := x.ClientStream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type BlobService_GetLFSPointersClient interface {
+ Recv() (*GetLFSPointersResponse, error)
+ grpc.ClientStream
+}
+
+type blobServiceGetLFSPointersClient struct {
+ grpc.ClientStream
+}
+
+func (x *blobServiceGetLFSPointersClient) Recv() (*GetLFSPointersResponse, error) {
+ m := new(GetLFSPointersResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
// Server API for BlobService service
type BlobServiceServer interface {
@@ -495,6 +606,7 @@ type BlobServiceServer interface {
// The blobs are sent in a continous stream, the caller is responsible for spliting
// them up into multiple blobs by their object IDs.
GetBlobs(*GetBlobsRequest, BlobService_GetBlobsServer) error
+ GetLFSPointers(*GetLFSPointersRequest, BlobService_GetLFSPointersServer) error
}
func RegisterBlobServiceServer(s *grpc.Server, srv BlobServiceServer) {
@@ -543,6 +655,27 @@ func (x *blobServiceGetBlobsServer) Send(m *GetBlobsResponse) error {
return x.ServerStream.SendMsg(m)
}
+func _BlobService_GetLFSPointers_Handler(srv interface{}, stream grpc.ServerStream) error {
+ m := new(GetLFSPointersRequest)
+ if err := stream.RecvMsg(m); err != nil {
+ return err
+ }
+ return srv.(BlobServiceServer).GetLFSPointers(m, &blobServiceGetLFSPointersServer{stream})
+}
+
+type BlobService_GetLFSPointersServer interface {
+ Send(*GetLFSPointersResponse) error
+ grpc.ServerStream
+}
+
+type blobServiceGetLFSPointersServer struct {
+ grpc.ServerStream
+}
+
+func (x *blobServiceGetLFSPointersServer) Send(m *GetLFSPointersResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
var _BlobService_serviceDesc = grpc.ServiceDesc{
ServiceName: "gitaly.BlobService",
HandlerType: (*BlobServiceServer)(nil),
@@ -558,6 +691,11 @@ var _BlobService_serviceDesc = grpc.ServiceDesc{
Handler: _BlobService_GetBlobs_Handler,
ServerStreams: true,
},
+ {
+ StreamName: "GetLFSPointers",
+ Handler: _BlobService_GetLFSPointers_Handler,
+ ServerStreams: true,
+ },
},
Metadata: "blob.proto",
}
@@ -565,22 +703,28 @@ var _BlobService_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("blob.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 266 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x31, 0x4f, 0xc3, 0x30,
- 0x10, 0x85, 0x71, 0x5d, 0x0a, 0xbd, 0x56, 0x50, 0x9d, 0x10, 0x58, 0x99, 0xa2, 0x4c, 0x99, 0x22,
- 0x14, 0x76, 0x24, 0x58, 0x18, 0x60, 0x32, 0xbf, 0x20, 0x21, 0x27, 0xb0, 0x64, 0xb8, 0x60, 0x1b,
- 0xa4, 0xf2, 0x2b, 0xf8, 0xc9, 0x28, 0x0e, 0x49, 0x81, 0x8a, 0xa9, 0xdb, 0xcb, 0xbb, 0xcb, 0x7b,
- 0x9f, 0x6c, 0x03, 0xd4, 0x96, 0xeb, 0xa2, 0x75, 0x1c, 0x18, 0x67, 0x8f, 0x26, 0x54, 0x76, 0x9d,
- 0x2c, 0xfd, 0x53, 0xe5, 0xa8, 0xe9, 0xdd, 0xcc, 0xc2, 0xd1, 0x0d, 0x85, 0x6b, 0xcb, 0xb5, 0xa6,
- 0xd7, 0x37, 0xf2, 0x01, 0x4b, 0x00, 0x47, 0x2d, 0x7b, 0x13, 0xd8, 0xad, 0x95, 0x48, 0x45, 0xbe,
- 0x28, 0xb1, 0xe8, 0x7f, 0x2e, 0xf4, 0x38, 0xd1, 0x3f, 0xb6, 0x70, 0x05, 0x92, 0x4d, 0xa3, 0x26,
- 0xa9, 0xc8, 0xe7, 0xba, 0x93, 0x78, 0x02, 0xfb, 0xd6, 0x3c, 0x9b, 0xa0, 0x64, 0x2a, 0x72, 0xa9,
- 0xfb, 0x8f, 0xec, 0x16, 0x8e, 0xc7, 0x36, 0xdf, 0xf2, 0x8b, 0x27, 0x44, 0x98, 0x7a, 0xf3, 0x41,
- 0xb1, 0x48, 0xea, 0xa8, 0x3b, 0xaf, 0xa9, 0x42, 0x15, 0xf3, 0x96, 0x3a, 0xea, 0xa1, 0x42, 0x8e,
- 0x15, 0x19, 0x8f, 0x61, 0x7e, 0x17, 0x76, 0x84, 0x29, 0x9b, 0xc6, 0xab, 0x49, 0x2a, 0xf3, 0xb9,
- 0x8e, 0xfa, 0x1f, 0xfa, 0x3b, 0x58, 0x6d, 0x0a, 0x77, 0xc5, 0x2f, 0x3f, 0x05, 0x2c, 0xba, 0xac,
- 0x7b, 0x72, 0xef, 0xe6, 0x81, 0xf0, 0x12, 0x0e, 0xbe, 0xd3, 0xf1, 0x74, 0x40, 0xfe, 0x7d, 0x35,
- 0xc9, 0xd9, 0x96, 0xdf, 0x53, 0x64, 0x7b, 0xe7, 0x02, 0xaf, 0xe0, 0x70, 0xa0, 0xc3, 0xbf, 0x8b,
- 0xc3, 0x01, 0x25, 0x6a, 0x7b, 0xb0, 0x89, 0xa8, 0x67, 0xf1, 0x4d, 0x5c, 0x7c, 0x05, 0x00, 0x00,
- 0xff, 0xff, 0x99, 0x07, 0x5e, 0x8d, 0x37, 0x02, 0x00, 0x00,
+ // 353 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcd, 0x4e, 0xe3, 0x30,
+ 0x10, 0x5e, 0xd7, 0xdd, 0xfe, 0x4c, 0xab, 0xdd, 0x6a, 0xb4, 0x5b, 0x42, 0x24, 0x50, 0x94, 0x53,
+ 0x4e, 0x15, 0x2a, 0xe2, 0x8a, 0x04, 0x87, 0x56, 0x88, 0x4a, 0x20, 0xf7, 0x01, 0xaa, 0x84, 0xb8,
+ 0x60, 0xc9, 0xd4, 0x21, 0x36, 0x48, 0xe5, 0x7d, 0x79, 0x0f, 0x14, 0xa7, 0xf9, 0xa1, 0x55, 0x4f,
+ 0xb9, 0x8d, 0x67, 0xe6, 0xfb, 0xc9, 0x17, 0x1b, 0x20, 0x92, 0x2a, 0x9a, 0x24, 0xa9, 0x32, 0x0a,
+ 0x3b, 0xcf, 0xc2, 0x84, 0x72, 0xeb, 0x0e, 0xf5, 0x4b, 0x98, 0xf2, 0x38, 0xef, 0xfa, 0x12, 0xfe,
+ 0xcc, 0xb9, 0xb9, 0x95, 0x2a, 0x62, 0xfc, 0xed, 0x9d, 0x6b, 0x83, 0x53, 0x80, 0x94, 0x27, 0x4a,
+ 0x0b, 0xa3, 0xd2, 0xad, 0x43, 0x3c, 0x12, 0x0c, 0xa6, 0x38, 0xc9, 0xc1, 0x13, 0x56, 0x4e, 0x58,
+ 0x6d, 0x0b, 0x47, 0x40, 0x95, 0x88, 0x9d, 0x96, 0x47, 0x82, 0x3e, 0xcb, 0x4a, 0xfc, 0x07, 0xbf,
+ 0xa5, 0x78, 0x15, 0xc6, 0xa1, 0x1e, 0x09, 0x28, 0xcb, 0x0f, 0xfe, 0x3d, 0xfc, 0x2d, 0xd5, 0x74,
+ 0xa2, 0x36, 0x9a, 0x23, 0x42, 0x5b, 0x8b, 0x4f, 0x6e, 0x85, 0x28, 0xb3, 0x75, 0xd6, 0x8b, 0x43,
+ 0x13, 0x5a, 0xbe, 0x21, 0xb3, 0x75, 0x21, 0x41, 0x4b, 0x09, 0x5f, 0x95, 0x64, 0xba, 0x89, 0x77,
+ 0x84, 0xb6, 0x12, 0xb1, 0x76, 0x5a, 0x1e, 0x0d, 0xfa, 0xcc, 0xd6, 0x47, 0xdc, 0x2f, 0x60, 0x54,
+ 0x09, 0x36, 0xb6, 0x3f, 0x03, 0x58, 0xcc, 0x96, 0x8f, 0x4a, 0x6c, 0x0c, 0x4f, 0x1b, 0xf0, 0xac,
+ 0xe1, 0xff, 0x9c, 0x9b, 0x8a, 0xaa, 0x51, 0x18, 0xa7, 0xd0, 0xcb, 0xae, 0xcc, 0xaa, 0x0a, 0xa4,
+ 0x9b, 0x9d, 0xef, 0x62, 0xed, 0x3f, 0xc0, 0x78, 0x5f, 0x67, 0x97, 0xc1, 0x15, 0x0c, 0xe5, 0x5a,
+ 0xaf, 0x92, 0x5d, 0xdf, 0x21, 0x1e, 0xad, 0x4b, 0x55, 0x10, 0x36, 0x90, 0x6b, 0x5d, 0xc0, 0xa7,
+ 0x5f, 0x04, 0x06, 0x59, 0x98, 0x4b, 0x9e, 0x7e, 0x88, 0x27, 0x8e, 0xd7, 0xd0, 0xdd, 0xc5, 0x8b,
+ 0xe3, 0x02, 0xfb, 0xf3, 0x6e, 0xba, 0x27, 0x07, 0xfd, 0xdc, 0x82, 0xff, 0xeb, 0x82, 0xe0, 0x0d,
+ 0xf4, 0x8a, 0xdf, 0x83, 0xfb, 0x8b, 0x45, 0x28, 0xae, 0x73, 0x38, 0xa8, 0x51, 0x2c, 0xed, 0x6b,
+ 0xa8, 0x7d, 0x23, 0x9e, 0xd5, 0xf6, 0x0f, 0x33, 0x76, 0xcf, 0x8f, 0x8d, 0x2b, 0xd2, 0xa8, 0x63,
+ 0x5f, 0xda, 0xe5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x6b, 0x28, 0x11, 0x8d, 0x03, 0x00,
+ 0x00,
}
diff --git a/vendor/gitlab.com/gitlab-org/gitaly-proto/go/operations.pb.go b/vendor/gitlab.com/gitlab-org/gitaly-proto/go/operations.pb.go
index 36a845714..3a06b6749 100644
--- a/vendor/gitlab.com/gitlab-org/gitaly-proto/go/operations.pb.go
+++ b/vendor/gitlab.com/gitlab-org/gitaly-proto/go/operations.pb.go
@@ -687,8 +687,8 @@ func (m *UserRevertResponse) GetPreReceiveError() string {
type UserCommitFilesActionHeader struct {
Action UserCommitFilesActionHeader_ActionType `protobuf:"varint,1,opt,name=action,enum=gitaly.UserCommitFilesActionHeader_ActionType" json:"action,omitempty"`
- FilePath string `protobuf:"bytes,2,opt,name=file_path,json=filePath" json:"file_path,omitempty"`
- PreviousPath string `protobuf:"bytes,3,opt,name=previous_path,json=previousPath" json:"previous_path,omitempty"`
+ FilePath []byte `protobuf:"bytes,2,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"`
+ PreviousPath []byte `protobuf:"bytes,3,opt,name=previous_path,json=previousPath,proto3" json:"previous_path,omitempty"`
Base64Content bool `protobuf:"varint,4,opt,name=base64_content,json=base64Content" json:"base64_content,omitempty"`
}
@@ -704,18 +704,18 @@ func (m *UserCommitFilesActionHeader) GetAction() UserCommitFilesActionHeader_Ac
return UserCommitFilesActionHeader_CREATE
}
-func (m *UserCommitFilesActionHeader) GetFilePath() string {
+func (m *UserCommitFilesActionHeader) GetFilePath() []byte {
if m != nil {
return m.FilePath
}
- return ""
+ return nil
}
-func (m *UserCommitFilesActionHeader) GetPreviousPath() string {
+func (m *UserCommitFilesActionHeader) GetPreviousPath() []byte {
if m != nil {
return m.PreviousPath
}
- return ""
+ return nil
}
func (m *UserCommitFilesActionHeader) GetBase64Content() bool {
@@ -1630,7 +1630,7 @@ var _OperationService_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("operations.proto", fileDescriptor7) }
var fileDescriptor7 = []byte{
- // 1356 bytes of a gzipped FileDescriptorProto
+ // 1357 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0x45,
0x14, 0xf7, 0xda, 0xee, 0xc6, 0x79, 0x76, 0x1c, 0x7b, 0xfa, 0x81, 0xeb, 0x36, 0x4d, 0xba, 0xa5,
0x50, 0x2a, 0x64, 0xa1, 0x80, 0xe0, 0x54, 0x50, 0x3e, 0x1c, 0xd2, 0x42, 0xda, 0xb0, 0x4d, 0x0a,
@@ -1678,42 +1678,42 @@ var fileDescriptor7 = []byte{
0x14, 0xbc, 0xff, 0x46, 0x4a, 0x7c, 0x9f, 0x87, 0x6b, 0x2a, 0xd9, 0xd5, 0xfa, 0x2d, 0x77, 0xc0,
0x82, 0xb5, 0x8e, 0x34, 0x77, 0x9b, 0xd1, 0x2e, 0xe3, 0x64, 0x0b, 0x4c, 0xaa, 0xfe, 0x95, 0x5f,
0xd5, 0xd5, 0x56, 0x34, 0xd4, 0x19, 0x8b, 0x5a, 0xfa, 0x67, 0x6f, 0xec, 0x33, 0x1b, 0x57, 0xcb,
- 0x9e, 0xfa, 0xb1, 0x3b, 0x60, 0x8e, 0x4f, 0x45, 0x1f, 0x5d, 0x2b, 0x49, 0xc2, 0x2e, 0x15, 0x7d,
- 0x72, 0x0b, 0x16, 0x7c, 0x39, 0x70, 0x78, 0x87, 0x81, 0x16, 0xd0, 0x4e, 0x55, 0x42, 0xa2, 0x12,
- 0x92, 0x47, 0x05, 0x0d, 0xd8, 0x9b, 0x6f, 0x38, 0x1d, 0x6f, 0x24, 0x18, 0xce, 0xd8, 0xf2, 0xa8,
- 0x50, 0xd4, 0x0d, 0x4d, 0xb4, 0x1e, 0x00, 0x4c, 0xb7, 0x27, 0x00, 0xe6, 0x86, 0xdd, 0x5e, 0xdb,
- 0x6b, 0xd7, 0x72, 0xa4, 0x0a, 0xa0, 0xbf, 0x9d, 0xcd, 0xfb, 0x76, 0xcd, 0x90, 0xbc, 0xfd, 0xdd,
- 0x4d, 0xc9, 0xcb, 0x93, 0x12, 0x14, 0x77, 0x1e, 0x3d, 0x69, 0xd7, 0x0a, 0x92, 0xba, 0xd9, 0x7e,
- 0xbf, 0xbd, 0xd7, 0xae, 0x15, 0xad, 0xef, 0x0c, 0x6c, 0xa5, 0x49, 0x3f, 0xc9, 0x3d, 0x30, 0xfb,
- 0xca, 0x57, 0x0c, 0xf7, 0xad, 0x13, 0xc0, 0xb2, 0x9d, 0xb3, 0x71, 0x11, 0x69, 0xc2, 0x5c, 0xe8,
- 0x84, 0x9a, 0xd1, 0xb6, 0x73, 0x76, 0x48, 0x58, 0xb7, 0x60, 0x45, 0x16, 0x90, 0x83, 0x51, 0x96,
- 0x20, 0x05, 0x8e, 0x46, 0xd1, 0xf1, 0xe9, 0x78, 0xe0, 0xd1, 0xae, 0xf5, 0x55, 0x01, 0xae, 0x27,
- 0x76, 0xc2, 0x6a, 0xc6, 0xb0, 0x9d, 0x4f, 0x4d, 0x27, 0x0a, 0xb5, 0x30, 0x53, 0xa8, 0xb7, 0xa1,
- 0x8a, 0x66, 0x87, 0xf5, 0xaa, 0x8b, 0x79, 0x41, 0x53, 0x77, 0xb0, 0x6a, 0x5f, 0x05, 0x82, 0x62,
- 0xf4, 0x50, 0xf4, 0x3d, 0xae, 0xd5, 0xe9, 0xd2, 0xae, 0x69, 0xce, 0x9a, 0x62, 0x28, 0xa5, 0x2d,
- 0xb8, 0x18, 0x97, 0x66, 0x43, 0xea, 0x0e, 0xb0, 0xca, 0xeb, 0x51, 0xf1, 0xb6, 0x64, 0xa4, 0xf7,
- 0x84, 0xb9, 0x93, 0xf7, 0x84, 0xd2, 0xc9, 0x7b, 0xc2, 0x2f, 0xe1, 0x51, 0x31, 0x13, 0x07, 0xf2,
- 0x76, 0x22, 0x43, 0x5e, 0xcc, 0xc8, 0x90, 0x58, 0xdc, 0x22, 0x29, 0xf2, 0xd6, 0xa4, 0xf0, 0xf2,
- 0xf1, 0x86, 0x92, 0x9e, 0x61, 0xb9, 0xb0, 0xd2, 0xd6, 0x6f, 0xc1, 0xcd, 0xd9, 0xfc, 0xe1, 0x7a,
- 0x97, 0x49, 0x02, 0xfd, 0x14, 0x5e, 0xa0, 0xa3, 0x86, 0x9c, 0x61, 0x47, 0x5b, 0x86, 0xb2, 0x3b,
- 0xea, 0xb2, 0xa7, 0xb1, 0x5e, 0x06, 0x8a, 0x74, 0x4c, 0x8f, 0xca, 0x18, 0xeb, 0x7f, 0x9c, 0x1c,
- 0x5b, 0xb2, 0xd4, 0xcf, 0x7d, 0xf6, 0xe3, 0x6a, 0x9b, 0xc8, 0xec, 0xa7, 0x09, 0xc7, 0x4c, 0xf4,
- 0x4b, 0x80, 0x45, 0xe0, 0x04, 0x7d, 0xaa, 0xf2, 0x78, 0xde, 0x9e, 0xd7, 0x94, 0xc7, 0x7d, 0x4a,
- 0xde, 0x81, 0x3a, 0x67, 0x43, 0x4f, 0xb0, 0x68, 0x96, 0x99, 0x99, 0x06, 0xd7, 0xb4, 0xf0, 0x94,
- 0x22, 0xfb, 0x23, 0x2a, 0xc0, 0xed, 0x75, 0x36, 0x57, 0x34, 0x51, 0x87, 0xc1, 0xfa, 0x3c, 0x3c,
- 0x9e, 0x34, 0x48, 0x93, 0x5b, 0x17, 0xa0, 0x3f, 0xd2, 0x34, 0x3d, 0xa1, 0xa3, 0x87, 0xd2, 0xb4,
- 0x53, 0x0c, 0x96, 0x12, 0x9a, 0x5e, 0xe2, 0xd8, 0x29, 0xf5, 0xf0, 0xcc, 0x59, 0xfd, 0xdd, 0x84,
- 0xda, 0x24, 0x31, 0x1e, 0x33, 0x7e, 0xe4, 0x76, 0x18, 0xf9, 0x10, 0x6a, 0xc9, 0x27, 0x0f, 0xb2,
- 0x1c, 0xcb, 0xe3, 0xd9, 0xf7, 0x9b, 0xe6, 0x4a, 0xb6, 0x80, 0xf6, 0xc9, 0xca, 0x85, 0x8a, 0xa3,
- 0x0f, 0x09, 0x71, 0xc5, 0x29, 0x8f, 0x1e, 0x71, 0xc5, 0x69, 0x6f, 0x10, 0x56, 0x8e, 0x3c, 0x84,
- 0x85, 0xd8, 0xed, 0x95, 0x5c, 0x9f, 0xb5, 0x66, 0x7a, 0x41, 0x6f, 0x2e, 0x65, 0x70, 0x93, 0xfa,
- 0x26, 0xef, 0x03, 0x71, 0x7d, 0xc9, 0xf7, 0x8b, 0xb8, 0xbe, 0x99, 0x47, 0x05, 0x2b, 0x47, 0x3e,
- 0x82, 0xc5, 0xc4, 0x55, 0x90, 0xdc, 0x88, 0xae, 0x99, 0xbd, 0xf9, 0x36, 0x97, 0x33, 0xf9, 0xa1,
- 0xd6, 0x3b, 0xc6, 0x6b, 0x06, 0x79, 0x0f, 0x2a, 0xd1, 0xeb, 0x0b, 0xb9, 0x16, 0x5d, 0x96, 0xb8,
- 0x77, 0x35, 0xaf, 0xa7, 0x33, 0x27, 0x66, 0x7e, 0x00, 0xd5, 0xf8, 0x04, 0x4d, 0xe2, 0x48, 0x25,
- 0xaf, 0x26, 0xcd, 0x1b, 0x59, 0xec, 0x89, 0xca, 0x36, 0xc0, 0x74, 0xfa, 0x22, 0x57, 0x63, 0xa5,
- 0x1b, 0x1d, 0x67, 0x9b, 0xcd, 0x34, 0xd6, 0x44, 0xcd, 0x13, 0x0d, 0x60, 0xa4, 0xef, 0xc5, 0x01,
- 0x9c, 0xed, 0xcc, 0x71, 0x00, 0x53, 0x1a, 0xa6, 0x04, 0x70, 0x6a, 0x9e, 0xac, 0xac, 0xa4, 0x79,
- 0x91, 0xb6, 0x95, 0x34, 0x2f, 0x5a, 0xac, 0x56, 0xee, 0xc0, 0x54, 0xef, 0x9b, 0xaf, 0xff, 0x15,
- 0x00, 0x00, 0xff, 0xff, 0x2e, 0x45, 0x80, 0x57, 0x09, 0x15, 0x00, 0x00,
+ 0x9e, 0xfa, 0xb1, 0x3b, 0x60, 0x8e, 0x4f, 0x45, 0x1f, 0xe7, 0x92, 0x92, 0x24, 0xec, 0x52, 0xd1,
+ 0x27, 0xb7, 0x60, 0xc1, 0x97, 0x03, 0x87, 0x77, 0x18, 0x68, 0x81, 0x82, 0x12, 0xa8, 0x84, 0x44,
+ 0x25, 0x24, 0x8f, 0x0a, 0x1a, 0xb0, 0x37, 0xdf, 0x70, 0x3a, 0xde, 0x48, 0x30, 0x9c, 0xb1, 0xe5,
+ 0x51, 0xa1, 0xa8, 0x1b, 0x9a, 0x68, 0x3d, 0x00, 0x98, 0x6e, 0x4f, 0x00, 0xcc, 0x0d, 0xbb, 0xbd,
+ 0xb6, 0xd7, 0xae, 0xe5, 0x48, 0x15, 0x40, 0x7f, 0x3b, 0x9b, 0xf7, 0xed, 0x9a, 0x21, 0x79, 0xfb,
+ 0xbb, 0x9b, 0x92, 0x97, 0x27, 0x25, 0x28, 0xee, 0x3c, 0x7a, 0xd2, 0xae, 0x15, 0x24, 0x75, 0xb3,
+ 0xfd, 0x7e, 0x7b, 0xaf, 0x5d, 0x2b, 0x5a, 0xdf, 0x19, 0xd8, 0x4a, 0x93, 0x7e, 0x92, 0x7b, 0x60,
+ 0xf6, 0x95, 0xaf, 0x18, 0xee, 0x5b, 0x27, 0x80, 0x65, 0x3b, 0x67, 0xe3, 0x22, 0xd2, 0x84, 0xb9,
+ 0xd0, 0x09, 0x85, 0xc5, 0x76, 0xce, 0x0e, 0x09, 0xeb, 0x16, 0xac, 0xc8, 0x02, 0x72, 0x30, 0xca,
+ 0x12, 0xa4, 0xc0, 0xd1, 0x28, 0x3a, 0x3e, 0x1d, 0x0f, 0x3c, 0xda, 0xb5, 0xbe, 0x2a, 0xc0, 0xf5,
+ 0xc4, 0x4e, 0x58, 0xcd, 0x18, 0xb6, 0xf3, 0xa9, 0xe9, 0x44, 0xa1, 0x16, 0x66, 0x0a, 0xf5, 0x36,
+ 0x54, 0xd1, 0xec, 0xb0, 0x5e, 0x75, 0x31, 0x2f, 0x68, 0xea, 0x0e, 0x56, 0xed, 0xab, 0x40, 0x50,
+ 0x8c, 0x1e, 0x8a, 0xbe, 0xc7, 0xb5, 0x3a, 0x5d, 0xda, 0x35, 0xcd, 0x59, 0x53, 0x0c, 0xa5, 0xb4,
+ 0x05, 0x17, 0xe3, 0xd2, 0x6c, 0x48, 0xdd, 0x01, 0x56, 0x79, 0x3d, 0x2a, 0xde, 0x96, 0x8c, 0xf4,
+ 0x9e, 0x30, 0x77, 0xf2, 0x9e, 0x50, 0x3a, 0x79, 0x4f, 0xf8, 0x25, 0x3c, 0x2a, 0x66, 0xe2, 0x40,
+ 0xde, 0x4e, 0x64, 0xc8, 0x8b, 0x19, 0x19, 0x12, 0x8b, 0x5b, 0x24, 0x45, 0xde, 0x9a, 0x14, 0x5e,
+ 0x3e, 0xde, 0x50, 0xd2, 0x33, 0x2c, 0x17, 0x56, 0xda, 0xfa, 0x2d, 0xb8, 0x39, 0x9b, 0x3f, 0x5c,
+ 0xef, 0x32, 0x49, 0xa0, 0x9f, 0xc2, 0x0b, 0x74, 0xd4, 0x90, 0x33, 0xec, 0x68, 0xcb, 0x50, 0x76,
+ 0x47, 0x5d, 0xf6, 0x34, 0xd6, 0xcb, 0x40, 0x91, 0x8e, 0xe9, 0x51, 0x19, 0x63, 0xfd, 0x8f, 0x93,
+ 0x63, 0x4b, 0x96, 0xfa, 0xb9, 0xcf, 0x7e, 0x5c, 0x6d, 0x13, 0x99, 0xfd, 0x34, 0xe1, 0x98, 0x89,
+ 0x7e, 0x09, 0xb0, 0x08, 0x9c, 0xa0, 0x4f, 0x55, 0x1e, 0xcf, 0xdb, 0xf3, 0x9a, 0xf2, 0xb8, 0x4f,
+ 0xc9, 0x3b, 0x50, 0xe7, 0x6c, 0xe8, 0x09, 0x16, 0xcd, 0x32, 0x33, 0xd3, 0xe0, 0x9a, 0x16, 0x9e,
+ 0x52, 0x64, 0x7f, 0x44, 0x05, 0xb8, 0xbd, 0xce, 0xe6, 0x8a, 0x26, 0xea, 0x30, 0x58, 0x9f, 0x87,
+ 0xc7, 0x93, 0x06, 0x69, 0x72, 0xeb, 0x02, 0xf4, 0x47, 0x9a, 0xa6, 0x27, 0x74, 0xf4, 0x50, 0x9a,
+ 0x76, 0x8a, 0xc1, 0x52, 0x42, 0xd3, 0x4b, 0x1c, 0x3b, 0xa5, 0x1e, 0x9e, 0x39, 0xab, 0xbf, 0x9b,
+ 0x50, 0x9b, 0x24, 0xc6, 0x63, 0xc6, 0x8f, 0xdc, 0x0e, 0x23, 0x1f, 0x42, 0x2d, 0xf9, 0xe4, 0x41,
+ 0x96, 0x63, 0x79, 0x3c, 0xfb, 0x7e, 0xd3, 0x5c, 0xc9, 0x16, 0xd0, 0x3e, 0x59, 0xb9, 0x50, 0x71,
+ 0xf4, 0x21, 0x21, 0xae, 0x38, 0xe5, 0xd1, 0x23, 0xae, 0x38, 0xed, 0x0d, 0xc2, 0xca, 0x91, 0x87,
+ 0xb0, 0x10, 0xbb, 0xbd, 0x92, 0xeb, 0xb3, 0xd6, 0x4c, 0x2f, 0xe8, 0xcd, 0xa5, 0x0c, 0x6e, 0x52,
+ 0xdf, 0xe4, 0x7d, 0x20, 0xae, 0x2f, 0xf9, 0x7e, 0x11, 0xd7, 0x37, 0xf3, 0xa8, 0x60, 0xe5, 0xc8,
+ 0x47, 0xb0, 0x98, 0xb8, 0x0a, 0x92, 0x1b, 0xd1, 0x35, 0xb3, 0x37, 0xdf, 0xe6, 0x72, 0x26, 0x3f,
+ 0xd4, 0x7a, 0xc7, 0x78, 0xcd, 0x20, 0xef, 0x41, 0x25, 0x7a, 0x7d, 0x21, 0xd7, 0xa2, 0xcb, 0x12,
+ 0xf7, 0xae, 0xe6, 0xf5, 0x74, 0xe6, 0xc4, 0xcc, 0x0f, 0xa0, 0x1a, 0x9f, 0xa0, 0x49, 0x1c, 0xa9,
+ 0xe4, 0xd5, 0xa4, 0x79, 0x23, 0x8b, 0x3d, 0x51, 0xd9, 0x06, 0x98, 0x4e, 0x5f, 0xe4, 0x6a, 0xac,
+ 0x74, 0xa3, 0xe3, 0x6c, 0xb3, 0x99, 0xc6, 0x9a, 0xa8, 0x79, 0xa2, 0x01, 0x8c, 0xf4, 0xbd, 0x38,
+ 0x80, 0xb3, 0x9d, 0x39, 0x0e, 0x60, 0x4a, 0xc3, 0x94, 0x00, 0x4e, 0xcd, 0x93, 0x95, 0x95, 0x34,
+ 0x2f, 0xd2, 0xb6, 0x92, 0xe6, 0x45, 0x8b, 0xd5, 0xca, 0x1d, 0x98, 0xea, 0x7d, 0xf3, 0xf5, 0xbf,
+ 0x02, 0x00, 0x00, 0xff, 0xff, 0x39, 0x0c, 0xa6, 0xa6, 0x09, 0x15, 0x00, 0x00,
}
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 72875f115..a2765c99b 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -189,24 +189,24 @@
"revisionTime": "2017-08-22T13:27:46Z"
},
{
- "checksumSHA1": "JXUVA1jky8ZX8w09p2t5KLs97Nc=",
+ "checksumSHA1": "uyVU5fRfEK17QZuODRjeZX8zDqg=",
"path": "github.com/stretchr/testify/assert",
- "revision": "4d4bfba8f1d1027c4fdbe371823030df51419987",
- "revisionTime": "2017-01-30T11:31:45Z"
+ "revision": "87b1dfb5b2fa649f52695dd9eae19abe404a4308",
+ "revisionTime": "2017-12-31T12:27:32Z"
},
{
- "checksumSHA1": "2PpOCNkWnshDrXeCVH2kp3VHhIM=",
+ "checksumSHA1": "c4nlsCmnaKoKaV62lzYk6wt8QY0=",
"path": "github.com/stretchr/testify/require",
- "revision": "4d4bfba8f1d1027c4fdbe371823030df51419987",
- "revisionTime": "2017-01-30T11:31:45Z"
+ "revision": "87b1dfb5b2fa649f52695dd9eae19abe404a4308",
+ "revisionTime": "2017-12-31T12:27:32Z"
},
{
- "checksumSHA1": "UVAREZ3CLZmXh1o4bJhetm6C1Z8=",
+ "checksumSHA1": "ZN7Ew/umcmsx5tI0Wjh6zMRueS0=",
"path": "gitlab.com/gitlab-org/gitaly-proto/go",
- "revision": "3348d391b1b2c7e6eef2934f1b941a6f4db7178e",
- "revisionTime": "2018-01-12T16:56:57Z",
- "version": "v0.73.0",
- "versionExact": "v0.73.0"
+ "revision": "f62abc80cb25363bf51a4f89f02654ca2f722dc8",
+ "revisionTime": "2018-01-17T16:23:27Z",
+ "version": "v0.75.0",
+ "versionExact": "v0.75.0"
},
{
"checksumSHA1": "nqWNlnMmVpt628zzvyo6Yv2CX5Q=",