reload_test.go
This commit is contained in:
parent
48a3fe6588
commit
179545f2bb
45
app/cmd/reload/reload_test.go
Normal file
45
app/cmd/reload/reload_test.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package reload
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFlushMapVal(t *testing.T) {
|
||||
t.Run("t1", func(t *testing.T) {
|
||||
v := GetAnyValMapBy("key", 2, struct{}{}, func(a struct{}) int {
|
||||
return 33
|
||||
})
|
||||
fmt.Println(v)
|
||||
FlushMapVal("key", 2)
|
||||
|
||||
v = GetAnyValMapBy("key", 2, struct{}{}, func(a struct{}) int {
|
||||
fmt.Println("xxxxx")
|
||||
return 33
|
||||
})
|
||||
fmt.Println(v)
|
||||
FlushAnyVal("key")
|
||||
v = GetAnyValMapBy("key", 2, struct{}{}, func(a struct{}) int {
|
||||
fmt.Println("yyyy")
|
||||
return 33
|
||||
})
|
||||
fmt.Println(v)
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAnyMapFnBys(t *testing.T) {
|
||||
var i int
|
||||
t.Run("t1", func(t *testing.T) {
|
||||
v := GetAnyMapFnBys[int]("name", func(a int) int {
|
||||
i++
|
||||
return a + 1
|
||||
})
|
||||
vv := v(1, 2)
|
||||
vvv := v(2, 3)
|
||||
fmt.Println(vv, vvv)
|
||||
v(1, 2)
|
||||
FlushMapVal("name", 2)
|
||||
v(2, 3)
|
||||
fmt.Println(i)
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user