...

Source file src/github.com/go-task/slim-sprig/v3/flow_control_test.go

Documentation: github.com/go-task/slim-sprig/v3

     1  package sprig
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestFail(t *testing.T) {
    11  	const msg = "This is an error!"
    12  	tpl := fmt.Sprintf(`{{fail "%s"}}`, msg)
    13  	_, err := runRaw(tpl, nil)
    14  	assert.Error(t, err)
    15  	assert.Contains(t, err.Error(), msg)
    16  }
    17  

View as plain text