github.com/MetalBlockchain/metalgo@v1.11.9/utils/timer/timer_test.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package timer
     5  
     6  import (
     7  	"sync"
     8  	"testing"
     9  	"time"
    10  )
    11  
    12  func TestTimer(*testing.T) {
    13  	wg := sync.WaitGroup{}
    14  	wg.Add(1)
    15  	defer wg.Wait()
    16  
    17  	timer := NewTimer(wg.Done)
    18  	go timer.Dispatch()
    19  
    20  	timer.SetTimeoutIn(time.Millisecond)
    21  }