github.com/tursom/GoCollections@v0.3.10/lang/ThreadLocal_test.go (about)

     1  /*
     2   * Copyright (c) 2022 tursom. All rights reserved.
     3   * Use of this source code is governed by a GPL-3
     4   * license that can be found in the LICENSE file.
     5   */
     6  
     7  package lang
     8  
     9  import (
    10  	"fmt"
    11  	"testing"
    12  )
    13  
    14  func TestThreadLocalImpl(t1 *testing.T) {
    15  	local := NewThreadLocal[int]()
    16  	fmt.Println(local.Get())
    17  	local.Put(1)
    18  	fmt.Println(local.Get())
    19  	local.Remove()
    20  	fmt.Println(local.Get())
    21  }