mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated console help regex
This commit is contained in:
committed by
Dan Christian Bogos
parent
a9f0a9429b
commit
89f85341a2
@@ -33,7 +33,7 @@ import (
|
||||
|
||||
var (
|
||||
lineR = regexp.MustCompile(`(\w+)\s*=\s*(\[.*?\]|\".*?\"|\{.*?\}|.+?)(?:\s+|$)`)
|
||||
jsonR = regexp.MustCompile(`"(\w+)":(\[.+?\]|.+?)[,|}]`)
|
||||
jsonR = regexp.MustCompile(`"(\w+)":(\[.+?\]|.+?)(?:,|}$)`)
|
||||
)
|
||||
|
||||
// Commander implementation
|
||||
|
||||
@@ -21,6 +21,8 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func TestToJSON(t *testing.T) {
|
||||
@@ -237,3 +239,17 @@ func TestGetFormatedSliceResult(t *testing.T) {
|
||||
t.Errorf("Expecting: %s , received: %s", expected, rply)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFromJSONInterestingFields2(t *testing.T) {
|
||||
jsn := utils.ToJSON(&utils.TenantIDWithOpts{
|
||||
TenantID: new(utils.TenantID),
|
||||
Opts: make(map[string]interface{}),
|
||||
})
|
||||
|
||||
line := FromJSON([]byte(jsn), []string{"Tenant", "ID", "Opts"})
|
||||
expected := `Tenant="" ID="" Opts={}`
|
||||
if line != expected {
|
||||
t.Log(jsn)
|
||||
t.Errorf("Expected: %s got: '%s'", expected, line)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user