mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
RSRField filter checking empty values
This commit is contained in:
@@ -89,9 +89,6 @@ func (rsrf *RSRField) ParseValue(value string) string {
|
||||
if len(rsrf.staticValue) != 0 { // Enforce parsing of static values
|
||||
return rsrf.staticValue
|
||||
}
|
||||
if len(value) == 0 {
|
||||
return value
|
||||
}
|
||||
for _, rsRule := range rsrf.RSRules {
|
||||
if rsRule != nil {
|
||||
value = rsRule.Process(value)
|
||||
|
||||
@@ -195,4 +195,14 @@ func TestFilterPasses(t *testing.T) {
|
||||
if rl.FilterPasses("0031ABOC0630415354") {
|
||||
t.Error("Passing filter")
|
||||
}
|
||||
rl, err = NewRSRField(`~1:s/^$/_empty_/(_empty_)`)
|
||||
if err != nil {
|
||||
t.Error("Unexpected error: ", err)
|
||||
}
|
||||
if !rl.FilterPasses("") {
|
||||
t.Error("Not passing filter")
|
||||
}
|
||||
if rl.FilterPasses("Non empty") {
|
||||
t.Error("Passing filter")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user