|
@@ -1,6 +1,7 @@
|
|
package test
|
|
package test
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
"git.sxidc.com/go-framework/baize/framework/core/tag/assign"
|
|
"git.sxidc.com/go-framework/baize/framework/core/tag/assign"
|
|
"git.sxidc.com/go-tools/utils/strutils"
|
|
"git.sxidc.com/go-tools/utils/strutils"
|
|
"github.com/pkg/errors"
|
|
"github.com/pkg/errors"
|
|
@@ -307,6 +308,8 @@ func (to AssignTagToPointerField) checkFields(t *testing.T, from AssignTagFrom)
|
|
from.StringField, *to.StringField))
|
|
from.StringField, *to.StringField))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ fmt.Println("from", from.BoolField)
|
|
|
|
+ fmt.Println("to", to.BoolField)
|
|
if from.BoolField != *to.BoolField {
|
|
if from.BoolField != *to.BoolField {
|
|
t.Fatalf("%+v\n", errors.Errorf("BoolField not equal: from %v, to %v",
|
|
t.Fatalf("%+v\n", errors.Errorf("BoolField not equal: from %v, to %v",
|
|
from.BoolField, *to.BoolField))
|
|
from.BoolField, *to.BoolField))
|
|
@@ -747,6 +750,7 @@ type AssignTagFromSlice struct {
|
|
FuncPointerSliceField []*func() string `assign:"toField:FuncPointerSliceField"`
|
|
FuncPointerSliceField []*func() string `assign:"toField:FuncPointerSliceField"`
|
|
FromStringSliceToStringField []string `assign:"toField:FromStringSliceToStringField"`
|
|
FromStringSliceToStringField []string `assign:"toField:FromStringSliceToStringField"`
|
|
FromTimeToStringField []time.Time `assign:"toField:FromTimeToStringField"`
|
|
FromTimeToStringField []time.Time `assign:"toField:FromTimeToStringField"`
|
|
|
|
+ FromStringToTimeField []string `assign:"toField:FromStringToTimeField"`
|
|
}
|
|
}
|
|
|
|
|
|
type AssignTagFromSlicePointerField struct {
|
|
type AssignTagFromSlicePointerField struct {
|
|
@@ -765,6 +769,7 @@ type AssignTagFromSlicePointerField struct {
|
|
FuncPointerSliceField *[]*func() string `assign:"toField:FuncPointerSliceField"`
|
|
FuncPointerSliceField *[]*func() string `assign:"toField:FuncPointerSliceField"`
|
|
FromStringSliceToStringField *[]string `assign:"toField:FromStringSliceToStringField"`
|
|
FromStringSliceToStringField *[]string `assign:"toField:FromStringSliceToStringField"`
|
|
FromTimeToStringField *[]time.Time `assign:"toField:FromTimeToStringField"`
|
|
FromTimeToStringField *[]time.Time `assign:"toField:FromTimeToStringField"`
|
|
|
|
+ FromStringToTimeField *[]string `assign:"toField:FromStringToTimeField"`
|
|
}
|
|
}
|
|
|
|
|
|
type AssignTagToSlice struct {
|
|
type AssignTagToSlice struct {
|
|
@@ -783,6 +788,7 @@ type AssignTagToSlice struct {
|
|
FuncPointerSliceField []*func() string
|
|
FuncPointerSliceField []*func() string
|
|
FromStringSliceToStringField string
|
|
FromStringSliceToStringField string
|
|
FromTimeToStringField string
|
|
FromTimeToStringField string
|
|
|
|
+ FromStringToTimeField []time.Time
|
|
}
|
|
}
|
|
|
|
|
|
func (to AssignTagToSlice) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
func (to AssignTagToSlice) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
@@ -964,6 +970,7 @@ type AssignTagToSlicePointerField struct {
|
|
FuncPointerSliceField *[]*func() string
|
|
FuncPointerSliceField *[]*func() string
|
|
FromStringSliceToStringField *string
|
|
FromStringSliceToStringField *string
|
|
FromTimeToStringField *string
|
|
FromTimeToStringField *string
|
|
|
|
+ FromStringToTimeField []time.Time
|
|
}
|
|
}
|
|
|
|
|
|
func (to AssignTagToSlicePointerField) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
func (to AssignTagToSlicePointerField) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
@@ -1204,6 +1211,8 @@ func TestAssignTagDefaultUsageSlice(t *testing.T) {
|
|
chanPointerSliceField := []*chan any{&chan1, &chan2}
|
|
chanPointerSliceField := []*chan any{&chan1, &chan2}
|
|
funcPointerSliceField := []*func() string{&func1, &func2}
|
|
funcPointerSliceField := []*func() string{&func1, &func2}
|
|
fromStringSliceToStringField := []string{str1, str2}
|
|
fromStringSliceToStringField := []string{str1, str2}
|
|
|
|
+ fromTimeToStringField := []time.Time{time1, time2}
|
|
|
|
+ fromStringToTimeField := []string{time1.Format(time.DateTime), time2.Format(time.DateTime)}
|
|
|
|
|
|
from := AssignTagFromSlice{
|
|
from := AssignTagFromSlice{
|
|
BasicField: basicField,
|
|
BasicField: basicField,
|
|
@@ -1220,6 +1229,8 @@ func TestAssignTagDefaultUsageSlice(t *testing.T) {
|
|
ChanPointerSliceField: chanPointerSliceField,
|
|
ChanPointerSliceField: chanPointerSliceField,
|
|
FuncPointerSliceField: funcPointerSliceField,
|
|
FuncPointerSliceField: funcPointerSliceField,
|
|
FromStringSliceToStringField: fromStringSliceToStringField,
|
|
FromStringSliceToStringField: fromStringSliceToStringField,
|
|
|
|
+ FromTimeToStringField: fromTimeToStringField,
|
|
|
|
+ FromStringToTimeField: fromStringToTimeField,
|
|
}
|
|
}
|
|
|
|
|
|
fromPointer := AssignTagFromSlicePointerField{
|
|
fromPointer := AssignTagFromSlicePointerField{
|
|
@@ -1237,6 +1248,8 @@ func TestAssignTagDefaultUsageSlice(t *testing.T) {
|
|
ChanPointerSliceField: &chanPointerSliceField,
|
|
ChanPointerSliceField: &chanPointerSliceField,
|
|
FuncPointerSliceField: &funcPointerSliceField,
|
|
FuncPointerSliceField: &funcPointerSliceField,
|
|
FromStringSliceToStringField: &fromStringSliceToStringField,
|
|
FromStringSliceToStringField: &fromStringSliceToStringField,
|
|
|
|
+ FromTimeToStringField: &fromTimeToStringField,
|
|
|
|
+ FromStringToTimeField: &fromStringToTimeField,
|
|
}
|
|
}
|
|
|
|
|
|
fromPointerNil := AssignTagFromPointerField{}
|
|
fromPointerNil := AssignTagFromPointerField{}
|