mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
RSRParser to support inner brackets
This commit is contained in:
@@ -119,7 +119,7 @@ func NewRSRParser(parserRules string, allFiltersMatch bool) (rsrParser *RSRParse
|
||||
}
|
||||
rsrParser = &RSRParser{Rules: parserRules, AllFiltersMatch: allFiltersMatch}
|
||||
if strings.HasSuffix(parserRules, utils.FILTER_VAL_END) { // Has filter, populate the var
|
||||
fltrStart := strings.LastIndex(parserRules, utils.FILTER_VAL_START)
|
||||
fltrStart := strings.Index(parserRules, utils.FILTER_VAL_START)
|
||||
if fltrStart < 1 {
|
||||
return nil, fmt.Errorf("invalid RSRFilter start rule in string: <%s>", parserRules)
|
||||
}
|
||||
|
||||
@@ -153,19 +153,15 @@ func TestRSRParsersParseEvent3(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Need to review RSRParser to accept ()
|
||||
func TestRSRParsersParseWrong(t *testing.T) {
|
||||
// TestRSRParsersParseInnerBraces makes sure the inner braces are allowed in a filter rule
|
||||
func TestRSRParsersParseInnerBracket(t *testing.T) {
|
||||
rule := "~*req.Service-Information.IN-Information.CalledPartyAddress(~^(00)*(33|0)890240004$)"
|
||||
prsr, err := NewRSRParser(rule, true)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
expAttrName := "*req.Service-Information.IN-Information.CalledPartyAddress"
|
||||
// we expected to get *req.Service-Information.IN-Information.CalledPartyAddress as attrName
|
||||
// and the rest go in filters
|
||||
if prsr.AttrName() != expAttrName {
|
||||
t.Errorf("expecting: %s, received: %s", expAttrName, prsr.AttrName())
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user