"refactor(vscode): 移除项目中的VSCode特定GOROOT配置"
This commit is contained in:
@@ -40,6 +40,31 @@ func TestThree(t *testing.T) {
|
||||
}
|
||||
fmt.Println(b.Bytes())
|
||||
}
|
||||
func TestMap(t *testing.T) {
|
||||
// 使用 SyncMap 存储字符串 -> int 类型的键值对
|
||||
sm1 := &SyncMap[string, int]{}
|
||||
sm1.Store("apple", 5)
|
||||
sm1.Store("banana", 10)
|
||||
|
||||
// 加载并打印值
|
||||
if value, ok := sm1.Load("apple"); ok {
|
||||
fmt.Println("apple:", value)
|
||||
}
|
||||
if value, ok := sm1.Load("banana"); ok {
|
||||
fmt.Println("banana:", value)
|
||||
}
|
||||
|
||||
// 使用 SyncMap 存储 int -> string 类型的键值对
|
||||
sm2 := &SyncMap[int, string]{}
|
||||
sm2.Store(1, "one")
|
||||
sm2.Store(2, "two")
|
||||
|
||||
// 遍历所有键值对
|
||||
sm2.Range(func(key int, value string) bool {
|
||||
fmt.Printf("%d: %s\n", key, value)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
table := termtables.CreateTable()
|
||||
|
||||
Reference in New Issue
Block a user