- mtwm.OrderLogisticsChange2Self

- TryInterface2xx
This commit is contained in:
gazebo
2019-03-27 11:20:11 +08:00
parent 273b459ed2
commit 4fa834f839
3 changed files with 84 additions and 8 deletions

32
utils/typeconv_test.go Normal file
View File

@@ -0,0 +1,32 @@
package utils
import (
"encoding/json"
"testing"
)
func TestConv(t *testing.T) {
for _, v := range [][]interface{}{
[]interface{}{
json.Number("123"),
int64(123),
},
[]interface{}{
json.Number("abc"),
int64(0),
},
[]interface{}{
"123",
int64(0),
},
[]interface{}{
int64(123),
int64(123),
},
} {
data := Interface2Int64WithDefault(v[0], 0)
if data != v[1].(int64) {
t.Fatal("Interface2Int64WithDefault failed")
}
}
}