mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Renamed NewPathToItem to NewPathItems
This commit is contained in:
committed by
Dan Christian Bogos
parent
fe7a046c16
commit
9184eb2f74
@@ -434,7 +434,7 @@ func TestUpdateDiamMsgFromNavMap1(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -443,7 +443,7 @@ func TestUpdateDiamMsgFromNavMap1(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -452,7 +452,7 @@ func TestUpdateDiamMsgFromNavMap1(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
if err := updateDiamMsgFromNavMap(m2, nM, ""); err != nil {
|
||||
@@ -518,7 +518,7 @@ func TestUpdateDiamMsgFromNavMap2(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -527,7 +527,7 @@ func TestUpdateDiamMsgFromNavMap2(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -537,7 +537,7 @@ func TestUpdateDiamMsgFromNavMap2(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -547,7 +547,7 @@ func TestUpdateDiamMsgFromNavMap2(t *testing.T) {
|
||||
nM.Set(
|
||||
&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem([]string{"Multiple-Services-Credit-Control", "Final-Unit-Indication", "Redirect-Server", "Redirect-Address-Type[1]"}),
|
||||
PathItems: utils.NewPathItems([]string{"Multiple-Services-Credit-Control", "Final-Unit-Indication", "Redirect-Server", "Redirect-Address-Type[1]"}),
|
||||
}, itm)
|
||||
if err := updateDiamMsgFromNavMap(m2, nM, ""); err != nil {
|
||||
t.Error(err)
|
||||
@@ -590,7 +590,7 @@ func TestUpdateDiamMsgFromNavMap3(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -599,7 +599,7 @@ func TestUpdateDiamMsgFromNavMap3(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -608,7 +608,7 @@ func TestUpdateDiamMsgFromNavMap3(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -617,7 +617,7 @@ func TestUpdateDiamMsgFromNavMap3(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
if err := updateDiamMsgFromNavMap(m2, nM, ""); err != nil {
|
||||
@@ -683,7 +683,7 @@ func TestUpdateDiamMsgFromNavMap4(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -692,7 +692,7 @@ func TestUpdateDiamMsgFromNavMap4(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -701,7 +701,7 @@ func TestUpdateDiamMsgFromNavMap4(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -710,7 +710,7 @@ func TestUpdateDiamMsgFromNavMap4(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
itm2 := &config.NMItem{
|
||||
@@ -720,7 +720,7 @@ func TestUpdateDiamMsgFromNavMap4(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm, itm2})
|
||||
|
||||
itm = &config.NMItem{
|
||||
@@ -729,7 +729,7 @@ func TestUpdateDiamMsgFromNavMap4(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
|
||||
if err := updateDiamMsgFromNavMap(m2, nM, ""); err != nil {
|
||||
|
||||
@@ -201,7 +201,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err != nil {
|
||||
t.Error(err)
|
||||
@@ -217,7 +217,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `item: <Rcode>, err: strconv.ParseInt: parsing "RandomValue": invalid syntax` {
|
||||
@@ -231,7 +231,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `item: <Order>, err: strconv.ParseInt: parsing "RandomValue": invalid syntax` {
|
||||
@@ -245,7 +245,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `item: <Preference>, err: strconv.ParseInt: parsing "RandomValue": invalid syntax` {
|
||||
@@ -261,7 +261,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `field <Order> only works with NAPTR` {
|
||||
@@ -275,7 +275,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `field <Preference> only works with NAPTR` {
|
||||
@@ -289,7 +289,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `field <Flags> only works with NAPTR` {
|
||||
@@ -303,7 +303,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `field <Service> only works with NAPTR` {
|
||||
@@ -317,7 +317,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `field <Regexp> only works with NAPTR` {
|
||||
@@ -331,7 +331,7 @@ func TestUpdateDNSMsgFromNM(t *testing.T) {
|
||||
}
|
||||
nM.Set(&utils.FullPath{
|
||||
Path: strings.Join(itm.Path, utils.NestingSep),
|
||||
PathItems: utils.NewPathToItem(itm.Path),
|
||||
PathItems: utils.NewPathItems(itm.Path),
|
||||
}, &utils.NMSlice{itm})
|
||||
if err := updateDNSMsgFromNM(m, nM); err == nil ||
|
||||
err.Error() != `field <Replacement> only works with NAPTR` {
|
||||
|
||||
@@ -90,9 +90,9 @@ func TestRadReplyAppendAttributes(t *testing.T) {
|
||||
v.ComputePath()
|
||||
}
|
||||
agReq := NewAgentRequest(nil, nil, nil, nil, nil, nil, "cgrates.org", "", nil, nil, nil)
|
||||
agReq.CGRReply.Set(utils.NewPathToItem([]string{utils.CapMaxUsage}), utils.NewNMData(time.Duration(time.Hour)))
|
||||
agReq.CGRReply.Set(utils.NewPathToItem([]string{utils.CapAttributes, "RadReply"}), utils.NewNMData("AccessAccept"))
|
||||
agReq.CGRReply.Set(utils.NewPathToItem([]string{utils.CapAttributes, utils.Account}), utils.NewNMData("1001"))
|
||||
agReq.CGRReply.Set(utils.NewPathItems([]string{utils.CapMaxUsage}), utils.NewNMData(time.Duration(time.Hour)))
|
||||
agReq.CGRReply.Set(utils.NewPathItems([]string{utils.CapAttributes, "RadReply"}), utils.NewNMData("AccessAccept"))
|
||||
agReq.CGRReply.Set(utils.NewPathItems([]string{utils.CapAttributes, utils.Account}), utils.NewNMData("1001"))
|
||||
|
||||
if err := agReq.SetFields(rplyFlds); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -42,9 +42,9 @@ func TestUpdateSIPMsgFromNavMap(t *testing.T) {
|
||||
v.ComputePath()
|
||||
}
|
||||
agReq := NewAgentRequest(nil, nil, nil, nil, nil, nil, "cgrates.org", "", nil, nil, nil)
|
||||
agReq.CGRReply.Set(utils.NewPathToItem([]string{utils.CapMaxUsage}), utils.NewNMData(time.Duration(time.Hour)))
|
||||
agReq.CGRReply.Set(utils.NewPathToItem([]string{utils.CapAttributes, "Request"}), utils.NewNMData("SIP/2.0 302 Moved Temporarily"))
|
||||
agReq.CGRReply.Set(utils.NewPathToItem([]string{utils.CapAttributes, utils.Account}), utils.NewNMData("1001"))
|
||||
agReq.CGRReply.Set(utils.NewPathItems([]string{utils.CapMaxUsage}), utils.NewNMData(time.Duration(time.Hour)))
|
||||
agReq.CGRReply.Set(utils.NewPathItems([]string{utils.CapAttributes, "Request"}), utils.NewNMData("SIP/2.0 302 Moved Temporarily"))
|
||||
agReq.CGRReply.Set(utils.NewPathItems([]string{utils.CapAttributes, utils.Account}), utils.NewNMData("1001"))
|
||||
|
||||
if err := agReq.SetFields(rplyFlds); err != nil {
|
||||
t.Error(err)
|
||||
@@ -65,8 +65,8 @@ func TestUpdateSIPMsgFromNavMap2(t *testing.T) {
|
||||
m := sipingo.Message{}
|
||||
mv := utils.NewOrderedNavigableMap()
|
||||
var nm *config.NMItem
|
||||
mv.Set(&utils.FullPath{PathItems: utils.NewPathToItem([]string{utils.CapAttributes, utils.Account}), Path: utils.CapAttributes + utils.NestingSep + utils.Account}, nm)
|
||||
mv.Set(&utils.FullPath{PathItems: utils.NewPathToItem([]string{utils.CapMaxUsage}), Path: utils.CapMaxUsage}, utils.NewNMData(time.Duration(time.Hour)))
|
||||
mv.Set(&utils.FullPath{PathItems: utils.NewPathItems([]string{utils.CapAttributes, utils.Account}), Path: utils.CapAttributes + utils.NestingSep + utils.Account}, nm)
|
||||
mv.Set(&utils.FullPath{PathItems: utils.NewPathItems([]string{utils.CapMaxUsage}), Path: utils.CapMaxUsage}, utils.NewNMData(time.Duration(time.Hour)))
|
||||
|
||||
expectedErr := `cannot encode reply value: [{"Field":"MaxUsage","Index":null}], err: not NMItems`
|
||||
if err := updateSIPMsgFromNavMap(m, mv); err == nil || err.Error() != expectedErr {
|
||||
|
||||
@@ -35,7 +35,7 @@ func NewFCTemplateFromFCTemplateJsonCfg(jsnCfg *FcTemplateJsonCfg, separator str
|
||||
if jsnCfg.Path != nil {
|
||||
fcTmp.Path = *jsnCfg.Path
|
||||
fcTmp.pathSlice = strings.Split(*jsnCfg.Path, utils.NestingSep)
|
||||
fcTmp.pathItems = utils.NewPathToItem(fcTmp.pathSlice)
|
||||
fcTmp.pathItems = utils.NewPathItems(fcTmp.pathSlice)
|
||||
fcTmp.Tag = fcTmp.Path
|
||||
}
|
||||
fcTmp.Tag = fcTmp.Path
|
||||
@@ -290,5 +290,5 @@ func (fc *FCTemplate) GetPathItems() utils.PathItems {
|
||||
// ComputePath used in test to populate private fields used to store the path
|
||||
func (fc *FCTemplate) ComputePath() {
|
||||
fc.pathSlice = strings.Split(fc.Path, utils.NestingSep)
|
||||
fc.pathItems = utils.NewPathToItem(fc.pathSlice)
|
||||
fc.pathItems = utils.NewPathItems(fc.pathSlice)
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ func generateRandomTemplate(size int) (out []benchData) {
|
||||
for i := 0; i < size; i++ {
|
||||
out[i].path = generateRandomPath()
|
||||
out[i].data = utils.UUIDSha1Prefix()
|
||||
out[i].pathItems = utils.NewPathToItem(out[i].path)
|
||||
out[i].pathItems = utils.NewPathItems(out[i].path)
|
||||
out[i].strPath = out[i].pathItems.String()
|
||||
// out[i].pathItems[len(out[i].pathItems)-1].Index = IntPointer(0)
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (nm NavigableMap2) Len() int {
|
||||
// Is used by AgentRequest FieldAsInterface
|
||||
func (nm NavigableMap2) FieldAsInterface(fldPath []string) (str interface{}, err error) {
|
||||
var nmi NMInterface
|
||||
if nmi, err = nm.Field(NewPathToItem(fldPath)); err != nil {
|
||||
if nmi, err = nm.Field(NewPathItems(fldPath)); err != nil {
|
||||
return
|
||||
}
|
||||
return nmi.Interface(), nil
|
||||
|
||||
@@ -145,7 +145,7 @@ func (onm OrderedNavigableMap) Len() int {
|
||||
// FieldAsString returns thevalue from path as string
|
||||
func (onm *OrderedNavigableMap) FieldAsString(fldPath []string) (str string, err error) {
|
||||
var val NMInterface
|
||||
val, err = onm.nm.Field(NewPathToItem(fldPath))
|
||||
val, err = onm.nm.Field(NewPathItems(fldPath))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func (onm *OrderedNavigableMap) FieldAsString(fldPath []string) (str string, err
|
||||
// FieldAsInterface returns the interface at the path
|
||||
func (onm *OrderedNavigableMap) FieldAsInterface(fldPath []string) (str interface{}, err error) {
|
||||
var val NMInterface
|
||||
val, err = onm.nm.Field(NewPathToItem(fldPath))
|
||||
val, err = onm.nm.Field(NewPathItems(fldPath))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ type FullPath struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// NewPathToItem returns the computed PathItems out of slice one
|
||||
func NewPathToItem(path []string) (pItms PathItems) {
|
||||
// NewPathItems returns the computed PathItems out of slice one
|
||||
func NewPathItems(path []string) (pItms PathItems) {
|
||||
pItms = make(PathItems, len(path))
|
||||
for i, v := range path {
|
||||
field, indx := GetPathIndex(v)
|
||||
|
||||
@@ -54,15 +54,15 @@ func TestStripIdxFromLastPathElm(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewPathToItem(t *testing.T) {
|
||||
func TestNewPathItems(t *testing.T) {
|
||||
pathSlice := strings.Split("*req.Field1[0].Account", NestingSep)
|
||||
expected := PathItems{{Field: MetaReq}, {Field: "Field1", Index: IntPointer(0)}, {Field: Account}}
|
||||
if rply := NewPathToItem(pathSlice); !reflect.DeepEqual(expected, rply) {
|
||||
if rply := NewPathItems(pathSlice); !reflect.DeepEqual(expected, rply) {
|
||||
t.Errorf("Expected: %s, received: %s", ToJSON(expected), ToJSON(rply))
|
||||
}
|
||||
pathSlice = []string{}
|
||||
expected = PathItems{}
|
||||
if rply := NewPathToItem(pathSlice); !reflect.DeepEqual(expected, rply) {
|
||||
if rply := NewPathItems(pathSlice); !reflect.DeepEqual(expected, rply) {
|
||||
t.Errorf("Expected: %s, received: %s", ToJSON(expected), ToJSON(rply))
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ func TestPathItemClone(t *testing.T) {
|
||||
|
||||
func TestPathItemsString(t *testing.T) {
|
||||
expected := "*req.Field1[0].Account"
|
||||
path := NewPathToItem(strings.Split(expected, NestingSep))
|
||||
path := NewPathItems(strings.Split(expected, NestingSep))
|
||||
if rply := path.String(); expected != rply {
|
||||
t.Errorf("Expected: %q, received: %q", expected, rply)
|
||||
}
|
||||
@@ -131,8 +131,8 @@ func TestPathItemsString(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPathItemsClone(t *testing.T) {
|
||||
path := NewPathToItem(strings.Split("*req.Field1[0].Account", NestingSep))
|
||||
expected := NewPathToItem(strings.Split("*req.Field1[0].Account", NestingSep))
|
||||
path := NewPathItems(strings.Split("*req.Field1[0].Account", NestingSep))
|
||||
expected := NewPathItems(strings.Split("*req.Field1[0].Account", NestingSep))
|
||||
rply := path.Clone()
|
||||
path[0] = PathItem{}
|
||||
if !reflect.DeepEqual(expected, rply) {
|
||||
|
||||
Reference in New Issue
Block a user