vendor dependencies with dep
This commit is contained in:
parent
93d8310491
commit
1384296a47
2712 changed files with 965742 additions and 0 deletions
50
vendor/github.com/go-ozzo/ozzo-validation/not_nil_test.go
generated
vendored
Normal file
50
vendor/github.com/go-ozzo/ozzo-validation/not_nil_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2016 Qiang Xue. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package validation
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type MyInterface interface {
|
||||
Hello()
|
||||
}
|
||||
|
||||
func TestNotNil(t *testing.T) {
|
||||
var v1 []int
|
||||
var v2 map[string]int
|
||||
var v3 *int
|
||||
var v4 interface{}
|
||||
var v5 MyInterface
|
||||
tests := []struct {
|
||||
tag string
|
||||
value interface{}
|
||||
err string
|
||||
}{
|
||||
{"t1", v1, "is required"},
|
||||
{"t2", v2, "is required"},
|
||||
{"t3", v3, "is required"},
|
||||
{"t4", v4, "is required"},
|
||||
{"t5", v5, "is required"},
|
||||
{"t6", "", ""},
|
||||
{"t7", 0, ""},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
r := NotNil
|
||||
err := r.Validate(test.value)
|
||||
assertError(t, test.err, err, test.tag)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_notNilRule_Error(t *testing.T) {
|
||||
r := NotNil
|
||||
assert.Equal(t, "is required", r.message)
|
||||
r2 := r.Error("123")
|
||||
assert.Equal(t, "is required", r.message)
|
||||
assert.Equal(t, "123", r2.message)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue