github.com/mongodb/grip@v0.0.0-20240213223901-f906268d82b9/message/stack_test.go (about)

     1  package message
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func funcA() string {
    10  	return funcB()
    11  }
    12  
    13  func funcB() string {
    14  	return funcC()
    15  }
    16  
    17  func funcC() string {
    18  	return NewStack(0, "").String()
    19  }
    20  
    21  // Don't add any code above this line unless you modify the line numbers in
    22  // TestPrintStack.
    23  
    24  func TestPrintStack(t *testing.T) {
    25  	assert := assert.New(t)
    26  	stack := funcA()
    27  	assert.Contains(stack, `message/stack_test.go:18 (funcC)`)
    28  	assert.Contains(stack, `message/stack_test.go:14 (funcB)`)
    29  	assert.Contains(stack, `message/stack_test.go:10 (funcA)`)
    30  }