Browse Source

add dump test

Umputun 5 years ago
parent
commit
7bcf2f55d8
1 changed files with 9 additions and 0 deletions
  1. 9 0
      app/main_test.go

+ 9 - 0
app/main_test.go

@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"net/http/httptest"
 	"os"
+	"strings"
 	"sync"
 	"sync/atomic"
 	"syscall"
@@ -125,6 +126,14 @@ func TestFormat(t *testing.T) {
 	}
 }
 
+func TestGetDump(t *testing.T) {
+	dump := getDump()
+	assert.True(t, strings.Contains(dump, "goroutine"))
+	assert.True(t, strings.Contains(dump, "[running]"))
+	assert.True(t, strings.Contains(dump, "app/main.go"))
+	log.Printf("\n dump: %s", dump)
+}
+
 type pubMock struct {
 	buf bytes.Buffer
 }