-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from wenj91/dev
u-update yaml package to v2.4.0
- Loading branch information
Showing
11 changed files
with
109 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
github.com/antonmedv/expr v1.1.4 h1:ReeidbMJQZsujmBaYdaCEtfAvSH5bd/HHApjhyorBlE= | ||
github.com/antonmedv/expr v1.1.4/go.mod h1:AdVomDZyjUit6l23+Owki7ZHDtvJDjsaP4YmqB44OJA= | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= | ||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= | ||
github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= | ||
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= | ||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
package gobatis | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
type TestStruct struct { | ||
|
||
} | ||
|
||
func TestVal(t *testing.T) { | ||
func TestVal(t *testing.T) { | ||
paramsInt := 1 | ||
v := reflect.ValueOf(paramsInt) | ||
assertTrue(v.Kind() == reflect.Int, "test fail: params is not int") | ||
assert.True(t, v.Kind() == reflect.Int, "test fail: params is not int") | ||
|
||
paramsInt64 := int64(1) | ||
v = reflect.ValueOf(paramsInt64) | ||
assertTrue(v.Kind() == reflect.Int64, "test fail: params is not int64") | ||
assert.True(t, v.Kind() == reflect.Int64, "test fail: params is not int64") | ||
|
||
paramsString := "" | ||
v = reflect.ValueOf(paramsString) | ||
assertTrue(v.Kind() == reflect.String, "test fail: params is not string") | ||
assert.True(t, v.Kind() == reflect.String, "test fail: params is not string") | ||
|
||
paramsSlice := []int{1, 2, 3} | ||
v = reflect.ValueOf(paramsSlice) | ||
assertTrue(v.Kind() == reflect.Slice, "test fail: params is not slice") | ||
assert.True(t, v.Kind() == reflect.Slice, "test fail: params is not slice") | ||
|
||
paramsStruct := TestStruct{} | ||
v = reflect.ValueOf(paramsStruct) | ||
assertTrue(v.Kind() == reflect.Struct, "test fail: params is not struct") | ||
assert.True(t, v.Kind() == reflect.Struct, "test fail: params is not struct") | ||
|
||
paramsPtr := &TestStruct{} | ||
v = reflect.ValueOf(paramsPtr) | ||
assertTrue(v.Kind() == reflect.Ptr, "test fail: params is not ptr") | ||
assert.True(t, v.Kind() == reflect.Ptr, "test fail: params is not ptr") | ||
v = v.Elem() | ||
assertTrue(v.Kind() == reflect.Struct, "test fail: params is not struct") | ||
assert.True(t, v.Kind() == reflect.Struct, "test fail: params is not struct") | ||
|
||
paramsStructs := []*TestStruct{{},{},{}} | ||
paramsStructs := []*TestStruct{{}, {}, {}} | ||
v = reflect.ValueOf(paramsStructs) | ||
assertTrue(v.Kind() == reflect.Slice, "test fail: params is not slice") | ||
assertTrue(v.Len() == 3, "test fail: params len != 3") | ||
assert.True(t, v.Kind() == reflect.Slice, "test fail: params is not slice") | ||
assert.True(t, v.Len() == 3, "test fail: params len != 3") | ||
v0 := v.Index(0) | ||
assertTrue(v0.Kind() == reflect.Ptr, "test fail: ele is not ptr") | ||
assert.True(t, v0.Kind() == reflect.Ptr, "test fail: ele is not ptr") | ||
v0 = v0.Elem() | ||
assertTrue(v0.Kind() == reflect.Struct, "test fail: ele is not struct") | ||
assert.True(t, v0.Kind() == reflect.Struct, "test fail: ele is not struct") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
package gobatis | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
"time" | ||
) | ||
|
||
type TestStruct2 struct { | ||
T NullTime | ||
S NullString | ||
T NullTime | ||
S NullString | ||
Id int64 | ||
} | ||
|
||
func TestParams(t *testing.T) { | ||
func TestParams(t *testing.T) { | ||
paramB := "" | ||
res := paramProcess(paramB) | ||
assertNotNil(res["0"], "test fail: res[0] == nil") | ||
assertEqual(res["0"], "", "test fail: res[0] != ''") | ||
|
||
assert.NotNil(t, res["0"], "test fail: res[0] == nil") | ||
assert.Equal(t, res["0"], "", "test fail: res[0] != ''") | ||
|
||
paramM := map[string]interface{}{ | ||
"id": nil, | ||
"name":"wenj91", | ||
"id": nil, | ||
"name": "wenj91", | ||
} | ||
res = paramProcess(paramM) | ||
assertNil(res["id"], "test fail: res['id'] != nil") | ||
assertNotNil(res["name"], "test fail: res['name'] == nil") | ||
assertEqual(res["name"], "wenj91", "test fail: res['name'] != 'wenj91'") | ||
assert.Nil(t, res["id"], "test fail: res['id'] != nil") | ||
assert.NotNil(t, res["name"], "test fail: res['name'] == nil") | ||
assert.Equal(t, res["name"], "wenj91", "test fail: res['name'] != 'wenj91'") | ||
|
||
paramNil := NullString{"str", true} | ||
res = paramProcess(paramNil) | ||
assertNotNil(res["0"], "test fail: res['0'] == nil") | ||
assertEqual(res["0"], "str", "test fail: res['0'] != 'str'") | ||
assert.NotNil(t, res["0"], "test fail: res['0'] == nil") | ||
assert.Equal(t, res["0"], "str", "test fail: res['0'] != 'str'") | ||
|
||
tt, _ := time.Parse("2006-01-02 15:04:05", "2006-01-02 15:04:05") | ||
paramS := &TestStruct2{ | ||
T: NullTime{tt, true}, | ||
} | ||
res = paramProcess(paramS) | ||
assertNotNil(res["T"], "test fail: res['T'] == nil") | ||
assertEqual(res["T"], "2006-01-02 15:04:05", "test fail: res['T'] != '2006-01-02 15:04:05'") | ||
assertNil(res["S"], "test fail: res['S'] != nil") | ||
assertEqual(res["Id"], int64(0), "test fail: res['Id'] != 0") | ||
assert.NotNil(t, res["T"], "test fail: res['T'] == nil") | ||
assert.Equal(t, res["T"], "2006-01-02 15:04:05", "test fail: res['T'] != '2006-01-02 15:04:05'") | ||
assert.Nil(t, res["S"], "test fail: res['S'] != nil") | ||
assert.Equal(t, res["Id"], int64(0), "test fail: res['Id'] != 0") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.