Kaynağa Gözat

add more tests

kevin 4 yıl önce
ebeveyn
işleme
360fbfd0fa
1 değiştirilmiş dosya ile 22 ekleme ve 0 silme
  1. 22 0
      core/stat/alert_test.go

+ 22 - 0
core/stat/alert_test.go

@@ -0,0 +1,22 @@
+// +build linux
+
+package stat
+
+import (
+	"strconv"
+	"sync/atomic"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestReport(t *testing.T) {
+	var count int32
+	SetReporter(func(s string) {
+		atomic.AddInt32(&count, 1)
+	})
+	for i := 0; i < 10; i++ {
+		Report(strconv.Itoa(i))
+	}
+	assert.Equal(t, int32(1), count)
+}