mirror of
https://github.com/tursom/GoCollections.git
synced 2024-12-26 07:50:12 +08:00
27 lines
454 B
Go
27 lines
454 B
Go
/*
|
|
* Copyright (c) 2022 tursom. All rights reserved.
|
|
* Use of this source code is governed by a GPL-3
|
|
* license that can be found in the LICENSE file.
|
|
*/
|
|
|
|
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))
|
|
}
|