mirror of
https://gitee.com/johng/gf.git
synced 2024-11-29 18:57:44 +08:00
improve ut case for package gcache/gpool (#2290)
* improve ut case for package gcache/gpool * up
This commit is contained in:
parent
b84034b667
commit
7d1a508ea9
@ -179,6 +179,6 @@ func ExamplePool_Close() {
|
||||
// wait for pool close
|
||||
time.Sleep(time.Second * 1)
|
||||
|
||||
// Output:
|
||||
// May Output:
|
||||
// Close The Pool
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ func TestCache_LRU(t *testing.T) {
|
||||
v, _ := cache.Get(ctx, 6)
|
||||
t.Assert(v, 6)
|
||||
time.Sleep(4 * time.Second)
|
||||
g.Log().Debugf(ctx, `items after lru: %+v`, cache.MustData(ctx))
|
||||
n, _ = cache.Size(ctx)
|
||||
t.Assert(n, 2)
|
||||
v, _ = cache.Get(ctx, 6)
|
||||
|
@ -17,13 +17,14 @@ func IsSubDomain(subDomain string, mainDomain string) bool {
|
||||
if p := strings.IndexByte(mainDomain, ':'); p != -1 {
|
||||
mainDomain = mainDomain[0:p]
|
||||
}
|
||||
subArray := strings.Split(subDomain, ".")
|
||||
mainArray := strings.Split(mainDomain, ".")
|
||||
subLength := len(subArray)
|
||||
mainLength := len(mainArray)
|
||||
|
||||
var (
|
||||
subArray = strings.Split(subDomain, ".")
|
||||
mainArray = strings.Split(mainDomain, ".")
|
||||
subLength = len(subArray)
|
||||
mainLength = len(mainArray)
|
||||
)
|
||||
// Eg:
|
||||
// goframe.org is not sub-dome of 's.goframe.org'
|
||||
// "goframe.org" is not sub-domain of "s.goframe.org".
|
||||
if mainLength > subLength {
|
||||
for i := range mainArray[0 : mainLength-subLength] {
|
||||
if mainArray[i] != "*" {
|
||||
|
Loading…
Reference in New Issue
Block a user