vendor/github.com/stretchr/testify/assert/assertion_format.go
author Mikael Berthe <mikael@lilotux.net>
Tue, 23 Aug 2022 22:39:43 +0200
changeset 260 445e01aede7e
parent 256 6d9efbef00a9
permissions -rw-r--r--
Update vendor directory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
/*
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
* THIS FILE MUST NOT BE EDITED BY HAND
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
 */
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     6
package assert
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
import (
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
	http "net/http"
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
	url "net/url"
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
	time "time"
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
// Conditionf uses a Comparison to assert a complex condition.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    16
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
	return Condition(t, comp, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
// Containsf asserts that the specified string, list(array, slice...) or map contains the
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
// specified substring or element.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    25
//    assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    26
//    assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    27
//    assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    28
func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    29
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    30
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    31
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    32
	return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    33
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    34
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
    35
// DirExistsf checks whether a directory exists in the given path. It also fails
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
    36
// if the path is a file rather a directory or there is an error checking whether it exists.
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    37
func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    38
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    39
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    40
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    41
	return DirExists(t, path, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    42
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    43
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    44
// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    45
// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    46
// the number of appearances of each of them in both lists should match.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    47
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    48
// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    49
func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    50
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    51
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    52
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    53
	return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    54
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    55
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    56
// Emptyf asserts that the specified object is empty.  I.e. nil, "", false, 0 or either
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    57
// a slice or a channel with len == 0.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    58
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    59
//  assert.Emptyf(t, obj, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    60
func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    61
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    62
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    63
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    64
	return Empty(t, object, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    65
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    66
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    67
// Equalf asserts that two objects are equal.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    68
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    69
//    assert.Equalf(t, 123, 123, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    70
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    71
// Pointer variable equality is determined based on the equality of the
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    72
// referenced values (as opposed to the memory addresses). Function equality
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    73
// cannot be determined and will always fail.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    74
func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    75
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    76
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    77
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    78
	return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    79
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    80
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    81
// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    82
// and that it is equal to the provided error.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    83
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    84
//   actualObj, err := SomeFunction()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    85
//   assert.EqualErrorf(t, err,  expectedErrorString, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    86
func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    87
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    88
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    89
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    90
	return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    91
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    92
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    93
// EqualValuesf asserts that two objects are equal or convertable to the same types
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    94
// and equal.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    95
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
    96
//    assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    97
func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    98
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    99
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   100
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   101
	return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   102
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   103
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   104
// Errorf asserts that a function returned an error (i.e. not `nil`).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   105
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   106
//   actualObj, err := SomeFunction()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   107
//   if assert.Errorf(t, err, "error message %s", "formatted") {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   108
// 	   assert.Equal(t, expectedErrorf, err)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   109
//   }
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   110
func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   111
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   112
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   113
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   114
	return Error(t, err, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   115
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   116
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   117
// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   118
// This is a wrapper for errors.As.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   119
func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   120
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   121
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   122
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   123
	return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   124
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   125
260
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   126
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   127
// and that the error contains the specified substring.
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   128
//
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   129
//   actualObj, err := SomeFunction()
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   130
//   assert.ErrorContainsf(t, err,  expectedErrorSubString, "error message %s", "formatted")
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   131
func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   132
	if h, ok := t.(tHelper); ok {
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   133
		h.Helper()
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   134
	}
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   135
	return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...)
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   136
}
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   137
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   138
// ErrorIsf asserts that at least one of the errors in err's chain matches target.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   139
// This is a wrapper for errors.Is.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   140
func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   141
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   142
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   143
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   144
	return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   145
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   146
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   147
// Eventuallyf asserts that given condition will be met in waitFor time,
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   148
// periodically checking target function each tick.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   149
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   150
//    assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   151
func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   152
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   153
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   154
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   155
	return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   156
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   157
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   158
// Exactlyf asserts that two objects are equal in value and type.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   159
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   160
//    assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   161
func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   162
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   163
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   164
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   165
	return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   166
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   167
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   168
// Failf reports a failure through
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   169
func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   170
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   171
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   172
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   173
	return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   174
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   175
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   176
// FailNowf fails test
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   177
func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   178
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   179
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   180
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   181
	return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   182
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   183
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   184
// Falsef asserts that the specified value is false.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   185
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   186
//    assert.Falsef(t, myBool, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   187
func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   188
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   189
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   190
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   191
	return False(t, value, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   192
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   193
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   194
// FileExistsf checks whether a file exists in the given path. It also fails if
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   195
// the path points to a directory or there is an error when trying to check the file.
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   196
func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   197
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   198
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   199
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   200
	return FileExists(t, path, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   201
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   202
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   203
// Greaterf asserts that the first element is greater than the second
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   204
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   205
//    assert.Greaterf(t, 2, 1, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   206
//    assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   207
//    assert.Greaterf(t, "b", "a", "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   208
func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   209
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   210
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   211
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   212
	return Greater(t, e1, e2, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   213
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   214
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   215
// GreaterOrEqualf asserts that the first element is greater than or equal to the second
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   216
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   217
//    assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   218
//    assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   219
//    assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   220
//    assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   221
func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   222
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   223
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   224
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   225
	return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   226
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   227
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   228
// HTTPBodyContainsf asserts that a specified handler returns a
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   229
// body that contains a string.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   230
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   231
//  assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   232
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   233
// Returns whether the assertion was successful (true) or not (false).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   234
func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   235
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   236
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   237
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   238
	return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   239
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   240
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   241
// HTTPBodyNotContainsf asserts that a specified handler returns a
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   242
// body that does not contain a string.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   243
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   244
//  assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   245
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   246
// Returns whether the assertion was successful (true) or not (false).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   247
func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   248
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   249
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   250
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   251
	return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   252
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   253
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   254
// HTTPErrorf asserts that a specified handler returns an error status code.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   255
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   256
//  assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   257
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   258
// Returns whether the assertion was successful (true) or not (false).
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   259
func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   260
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   261
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   262
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   263
	return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   264
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   265
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   266
// HTTPRedirectf asserts that a specified handler returns a redirect status code.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   267
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   268
//  assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   269
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   270
// Returns whether the assertion was successful (true) or not (false).
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   271
func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   272
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   273
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   274
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   275
	return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   276
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   277
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   278
// HTTPStatusCodef asserts that a specified handler returns a specified status code.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   279
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   280
//  assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   281
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   282
// Returns whether the assertion was successful (true) or not (false).
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   283
func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   284
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   285
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   286
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   287
	return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   288
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   289
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   290
// HTTPSuccessf asserts that a specified handler returns a success status code.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   291
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   292
//  assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   293
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   294
// Returns whether the assertion was successful (true) or not (false).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   295
func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   296
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   297
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   298
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   299
	return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   300
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   301
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   302
// Implementsf asserts that an object is implemented by the specified interface.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   303
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   304
//    assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   305
func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   306
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   307
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   308
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   309
	return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   310
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   311
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   312
// InDeltaf asserts that the two numerals are within delta of each other.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   313
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   314
// 	 assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   315
func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   316
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   317
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   318
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   319
	return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   320
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   321
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   322
// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   323
func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   324
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   325
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   326
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   327
	return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   328
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   329
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   330
// InDeltaSlicef is the same as InDelta, except it compares two slices.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   331
func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   332
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   333
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   334
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   335
	return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   336
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   337
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   338
// InEpsilonf asserts that expected and actual have a relative error less than epsilon
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   339
func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   340
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   341
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   342
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   343
	return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   344
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   345
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   346
// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   347
func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   348
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   349
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   350
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   351
	return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   352
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   353
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   354
// IsDecreasingf asserts that the collection is decreasing
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   355
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   356
//    assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   357
//    assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   358
//    assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   359
func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   360
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   361
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   362
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   363
	return IsDecreasing(t, object, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   364
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   365
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   366
// IsIncreasingf asserts that the collection is increasing
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   367
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   368
//    assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   369
//    assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   370
//    assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   371
func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   372
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   373
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   374
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   375
	return IsIncreasing(t, object, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   376
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   377
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   378
// IsNonDecreasingf asserts that the collection is not decreasing
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   379
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   380
//    assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   381
//    assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   382
//    assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   383
func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   384
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   385
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   386
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   387
	return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   388
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   389
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   390
// IsNonIncreasingf asserts that the collection is not increasing
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   391
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   392
//    assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   393
//    assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   394
//    assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   395
func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   396
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   397
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   398
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   399
	return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   400
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   401
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   402
// IsTypef asserts that the specified objects are of the same type.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   403
func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   404
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   405
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   406
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   407
	return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   408
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   409
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   410
// JSONEqf asserts that two JSON strings are equivalent.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   411
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   412
//  assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   413
func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   414
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   415
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   416
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   417
	return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   418
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   419
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   420
// Lenf asserts that the specified object has specific length.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   421
// Lenf also fails if the object has a type that len() not accept.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   422
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   423
//    assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   424
func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   425
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   426
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   427
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   428
	return Len(t, object, length, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   429
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   430
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   431
// Lessf asserts that the first element is less than the second
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   432
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   433
//    assert.Lessf(t, 1, 2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   434
//    assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   435
//    assert.Lessf(t, "a", "b", "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   436
func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   437
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   438
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   439
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   440
	return Less(t, e1, e2, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   441
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   442
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   443
// LessOrEqualf asserts that the first element is less than or equal to the second
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   444
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   445
//    assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   446
//    assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   447
//    assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   448
//    assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   449
func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   450
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   451
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   452
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   453
	return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   454
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   455
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   456
// Negativef asserts that the specified element is negative
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   457
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   458
//    assert.Negativef(t, -1, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   459
//    assert.Negativef(t, -1.23, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   460
func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   461
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   462
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   463
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   464
	return Negative(t, e, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   465
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   466
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   467
// Neverf asserts that the given condition doesn't satisfy in waitFor time,
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   468
// periodically checking the target function each tick.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   469
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   470
//    assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   471
func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   472
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   473
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   474
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   475
	return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   476
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   477
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   478
// Nilf asserts that the specified object is nil.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   479
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   480
//    assert.Nilf(t, err, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   481
func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   482
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   483
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   484
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   485
	return Nil(t, object, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   486
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   487
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   488
// NoDirExistsf checks whether a directory does not exist in the given path.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   489
// It fails if the path points to an existing _directory_ only.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   490
func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   491
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   492
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   493
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   494
	return NoDirExists(t, path, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   495
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   496
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   497
// NoErrorf asserts that a function returned no error (i.e. `nil`).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   498
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   499
//   actualObj, err := SomeFunction()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   500
//   if assert.NoErrorf(t, err, "error message %s", "formatted") {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   501
// 	   assert.Equal(t, expectedObj, actualObj)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   502
//   }
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   503
func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   504
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   505
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   506
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   507
	return NoError(t, err, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   508
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   509
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   510
// NoFileExistsf checks whether a file does not exist in a given path. It fails
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   511
// if the path points to an existing _file_ only.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   512
func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   513
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   514
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   515
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   516
	return NoFileExists(t, path, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   517
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   518
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   519
// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   520
// specified substring or element.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   521
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   522
//    assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   523
//    assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   524
//    assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   525
func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   526
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   527
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   528
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   529
	return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   530
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   531
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   532
// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, "", false, 0 or either
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   533
// a slice or a channel with len == 0.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   534
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   535
//  if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   536
//    assert.Equal(t, "two", obj[1])
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   537
//  }
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   538
func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   539
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   540
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   541
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   542
	return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   543
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   544
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   545
// NotEqualf asserts that the specified values are NOT equal.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   546
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   547
//    assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   548
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   549
// Pointer variable equality is determined based on the equality of the
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   550
// referenced values (as opposed to the memory addresses).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   551
func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   552
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   553
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   554
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   555
	return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   556
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   557
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   558
// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   559
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   560
//    assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   561
func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   562
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   563
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   564
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   565
	return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   566
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   567
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   568
// NotErrorIsf asserts that at none of the errors in err's chain matches target.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   569
// This is a wrapper for errors.Is.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   570
func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   571
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   572
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   573
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   574
	return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   575
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   576
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   577
// NotNilf asserts that the specified object is not nil.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   578
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   579
//    assert.NotNilf(t, err, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   580
func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   581
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   582
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   583
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   584
	return NotNil(t, object, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   585
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   586
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   587
// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   588
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   589
//   assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   590
func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   591
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   592
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   593
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   594
	return NotPanics(t, f, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   595
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   596
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   597
// NotRegexpf asserts that a specified regexp does not match a string.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   598
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   599
//  assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   600
//  assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   601
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   602
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   603
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   604
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   605
	return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   606
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   607
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   608
// NotSamef asserts that two pointers do not reference the same object.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   609
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   610
//    assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   611
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   612
// Both arguments must be pointer variables. Pointer variable sameness is
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   613
// determined based on the equality of both type and value.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   614
func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   615
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   616
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   617
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   618
	return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   619
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   620
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   621
// NotSubsetf asserts that the specified list(array, slice...) contains not all
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   622
// elements given in the specified subset(array, slice...).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   623
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   624
//    assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   625
func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   626
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   627
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   628
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   629
	return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   630
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   631
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   632
// NotZerof asserts that i is not the zero value for its type.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   633
func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   634
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   635
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   636
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   637
	return NotZero(t, i, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   638
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   639
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   640
// Panicsf asserts that the code inside the specified PanicTestFunc panics.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   641
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   642
//   assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   643
func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   644
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   645
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   646
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   647
	return Panics(t, f, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   648
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   649
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   650
// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   651
// panics, and that the recovered panic value is an error that satisfies the
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   652
// EqualError comparison.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   653
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   654
//   assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   655
func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   656
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   657
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   658
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   659
	return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   660
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   661
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   662
// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   663
// the recovered panic value equals the expected panic value.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   664
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   665
//   assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   666
func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   667
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   668
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   669
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   670
	return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   671
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   672
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   673
// Positivef asserts that the specified element is positive
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   674
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   675
//    assert.Positivef(t, 1, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   676
//    assert.Positivef(t, 1.23, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   677
func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   678
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   679
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   680
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   681
	return Positive(t, e, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   682
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   683
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   684
// Regexpf asserts that a specified regexp matches a string.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   685
//
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   686
//  assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   687
//  assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   688
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   689
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   690
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   691
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   692
	return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   693
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   694
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   695
// Samef asserts that two pointers reference the same object.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   696
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   697
//    assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   698
//
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   699
// Both arguments must be pointer variables. Pointer variable sameness is
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   700
// determined based on the equality of both type and value.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   701
func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   702
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   703
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   704
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   705
	return Same(t, expected, actual, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   706
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   707
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   708
// Subsetf asserts that the specified list(array, slice...) contains all
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   709
// elements given in the specified subset(array, slice...).
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   710
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   711
//    assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   712
func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   713
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   714
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   715
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   716
	return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   717
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   718
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   719
// Truef asserts that the specified value is true.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   720
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   721
//    assert.Truef(t, myBool, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   722
func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   723
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   724
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   725
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   726
	return True(t, value, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   727
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   728
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   729
// WithinDurationf asserts that the two times are within duration delta of each other.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   730
//
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   731
//   assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   732
func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   733
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   734
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   735
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   736
	return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   737
}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   738
260
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   739
// WithinRangef asserts that a time is within a time range (inclusive).
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   740
//
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   741
//   assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   742
func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   743
	if h, ok := t.(tHelper); ok {
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   744
		h.Helper()
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   745
	}
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   746
	return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...)
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   747
}
445e01aede7e Update vendor directory
Mikael Berthe <mikael@lilotux.net>
parents: 256
diff changeset
   748
256
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   749
// YAMLEqf asserts that two YAML strings are equivalent.
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   750
func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   751
	if h, ok := t.(tHelper); ok {
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   752
		h.Helper()
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   753
	}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   754
	return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...)
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   755
}
6d9efbef00a9 Update dependencies
Mikael Berthe <mikael@lilotux.net>
parents: 242
diff changeset
   756
242
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   757
// Zerof asserts that i is the zero value for its type.
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   758
func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   759
	if h, ok := t.(tHelper); ok {
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   760
		h.Helper()
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   761
	}
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   762
	return Zero(t, i, append([]interface{}{msg}, args...)...)
2a9ec03fe5a1 Use vendoring for backward compatibility
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   763
}