- mtwm.OrderLogisticsChange2Self
- TryInterface2xx
This commit is contained in:
32
utils/typeconv_test.go
Normal file
32
utils/typeconv_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user