mirror of
https://github.com/tursom/GoCollections.git
synced 2024-12-27 17:10:25 +08:00
21 lines
295 B
Go
21 lines
295 B
Go
package util
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestContextKey(t *testing.T) {
|
|
ctx := NewContext()
|
|
key := AllocateContextKey[int](ctx)
|
|
|
|
m := ctx.NewConcurrentMap()
|
|
|
|
fmt.Println(key.Get(m))
|
|
fmt.Println(key.TryGet(m))
|
|
|
|
key.Set(m, 100)
|
|
fmt.Println(key.Get(m))
|
|
fmt.Println(key.TryGet(m))
|
|
}
|