Files
EdgeAPI/internal/utils/cache_map_test.go

28 lines
406 B
Go
Raw Normal View History

2024-05-17 18:27:26 +08:00
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
2021-11-11 14:16:42 +08:00
package utils
import (
"testing"
2024-07-27 14:15:25 +08:00
"github.com/iwind/TeaGo/assert"
2021-11-11 14:16:42 +08:00
)
func TestNewCacheMap(t *testing.T) {
var a = assert.NewAssertion(t)
m := NewCacheMap()
{
m.Put("Hello", "World")
v, ok := m.Get("Hello")
a.IsTrue(ok)
a.IsTrue(v == "World")
}
{
v, ok := m.Get("Hello1")
a.IsFalse(ok)
a.IsTrue(v == nil)
}
}