mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39959 from thaJeztah/fix_golint
integration-cli: fix golint issues
This commit is contained in:
commit
79da31de4f
1 changed files with 10 additions and 4 deletions
|
@ -9,32 +9,38 @@ import (
|
||||||
"gotest.tools/assert/cmp"
|
"gotest.tools/assert/cmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Compare defines the interface to compare values
|
||||||
type Compare func(x interface{}) assert.BoolOrComparison
|
type Compare func(x interface{}) assert.BoolOrComparison
|
||||||
|
|
||||||
|
// False checks if the value is false
|
||||||
func False() Compare {
|
func False() Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return !x.(bool)
|
return !x.(bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// True checks if the value is true
|
||||||
func True() Compare {
|
func True() Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Equals checks if the value is equal to the given value
|
||||||
func Equals(y interface{}) Compare {
|
func Equals(y interface{}) Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return cmp.Equal(x, y)
|
return cmp.Equal(x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Contains checks if the value contains the given value
|
||||||
func Contains(y interface{}) Compare {
|
func Contains(y interface{}) Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return cmp.Contains(x, y)
|
return cmp.Contains(x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not checks if two values are not
|
||||||
func Not(c Compare) Compare {
|
func Not(c Compare) Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
r := c(x)
|
r := c(x)
|
||||||
|
@ -49,30 +55,30 @@ func Not(c Compare) Compare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepEquals checks if two values are equal
|
||||||
func DeepEquals(y interface{}) Compare {
|
func DeepEquals(y interface{}) Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return cmp.DeepEqual(x, y)
|
return cmp.DeepEqual(x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepEquals compares if two values are deepequal
|
||||||
func HasLen(y int) Compare {
|
func HasLen(y int) Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return cmp.Len(x, y)
|
return cmp.Len(x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepEquals checks if the given value is nil
|
||||||
func IsNil() Compare {
|
func IsNil() Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return cmp.Nil(x)
|
return cmp.Nil(x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GreaterThan checks if the value is greater than the given value
|
||||||
func GreaterThan(y int) Compare {
|
func GreaterThan(y int) Compare {
|
||||||
return func(x interface{}) assert.BoolOrComparison {
|
return func(x interface{}) assert.BoolOrComparison {
|
||||||
return x.(int) > y
|
return x.(int) > y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NotNil() Compare {
|
|
||||||
return Not(IsNil())
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue