alert_test.go 340 B

1234567891011121314151617181920212223
  1. //go:build linux
  2. // +build linux
  3. package stat
  4. import (
  5. "strconv"
  6. "sync/atomic"
  7. "testing"
  8. "github.com/stretchr/testify/assert"
  9. )
  10. func TestReport(t *testing.T) {
  11. var count int32
  12. SetReporter(func(s string) {
  13. atomic.AddInt32(&count, 1)
  14. })
  15. for i := 0; i < 10; i++ {
  16. Report(strconv.Itoa(i))
  17. }
  18. assert.Equal(t, int32(1), count)
  19. }