1
0

shutdown_test.go 248 B

123456789101112131415161718192021
  1. package shutdown
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. func TestShutdown(t *testing.T) {
  7. s := New()
  8. go func() {
  9. time.Sleep(time.Millisecond)
  10. s.Start()
  11. }()
  12. s.WaitStart()
  13. go func() {
  14. time.Sleep(time.Millisecond)
  15. s.Done()
  16. }()
  17. s.WaitDone()
  18. }