Removed unused functions and tests in utils

This commit is contained in:
andronache
2020-11-11 15:55:58 +02:00
committed by Dan Christian Bogos
parent ae1eeb35ab
commit ae76b8af50
13 changed files with 17 additions and 908 deletions

View File

@@ -852,51 +852,6 @@ func TestFmtFieldWidth(t *testing.T) {
}
}
func TestCastIfToString(t *testing.T) {
v := interface{}("somestr")
if sOut, casts := CastIfToString(v); !casts {
t.Error("Does not cast")
} else if sOut != "somestr" {
t.Errorf("Received: %+v", sOut)
}
v = interface{}(1)
if sOut, casts := CastIfToString(v); !casts {
t.Error("Does not cast")
} else if sOut != "1" {
t.Errorf("Received: %+v", sOut)
}
v = interface{}((int64)(1))
if sOut, casts := CastIfToString(v); !casts {
t.Error("Does not cast")
} else if sOut != "1" {
t.Errorf("Received: %+v", sOut)
}
v = interface{}(true)
if sOut, casts := CastIfToString(v); !casts {
t.Error("Does not cast")
} else if sOut != "true" {
t.Errorf("Received: %+v", sOut)
}
v = interface{}([]byte("test"))
if sOut, casts := CastIfToString(v); !casts {
t.Error("Does not cast")
} else if sOut != "test" {
t.Errorf("Received: %+v", sOut)
}
v = interface{}(1.2)
if sOut, casts := CastIfToString(v); !casts {
t.Error("Does not cast")
} else if sOut != "1.2" {
t.Errorf("Received: %+v", sOut)
}
//default
v = interface{}([]string{"test"})
if _, casts := CastIfToString(v); casts {
t.Error("Does cast")
}
}
func TestEndOfMonth(t *testing.T) {
eom := GetEndOfMonth(time.Date(2016, time.February, 5, 10, 1, 2, 3, time.UTC))
expected := time.Date(2016, time.February, 29, 23, 59, 59, 0, time.UTC)
@@ -1197,12 +1152,6 @@ func TestLess(t *testing.T) {
}
}
func TestCapitalizedMessage(t *testing.T) {
if capMsg := CapitalizedMessage(ServiceAlreadyRunning); capMsg != "SERVICE_ALREADY_RUNNING" {
t.Errorf("Received: <%s>", capMsg)
}
}
func TestGetCGRVersion(t *testing.T) {
GitLastLog = `commit 73014daa0c1d7edcb532d5fe600b8a20d588cdf8
Author: DanB <danb@cgrates.org>