github.com/crosseyed/versionbump@v1.1.0/internal/app_test.go (about)

     1  package internal
     2  
     3  import (
     4  	"errors"
     5  	"github.com/stretchr/testify/assert"
     6  	"testing"
     7  )
     8  
     9  var TA = AppHelper{mode: Testing}
    10  
    11  func TestAppHelper_Errors_nil(t *testing.T) {
    12  	err := errors.New("The world is flat")
    13  	defer func() {
    14  		if r := recover(); r != nil {
    15  			assert.NotNil(t, r)
    16  		} else {
    17  			assert.Fail(t, "")
    18  		}
    19  	}()
    20  	TA.Errors(err, nil)
    21  }
    22  
    23  func TestAppHelper_Errors_fill(t *testing.T) {
    24  	err := errors.New("42 is the answer")
    25  	ok := false
    26  	TA.Errors(err, func(err error) {
    27  		ok = true
    28  	})
    29  
    30  	assert.True(t, ok)
    31  }